Implement a more robust Config (#60)
* Implement a more robust Config This moves the configuration variables from the `.env` file to a new `bewcloud.config.ts` file. Note that DB connection and secrets are still in the `.env` file. This will allow for more reliable and easier personalized configurations, and was a requirement to start working on adding SSO (#13). For now, `.env`-based config will still be allowed and respected (overriden by `bewcloud.config.ts`), but in the future I'll probably remove it (some major upgrade). * Update deploy script to also copy the new config file
This commit is contained in:
@@ -1,28 +1,6 @@
|
||||
import { currencyMap } from '/lib/types.ts';
|
||||
import { SupportedCurrencySymbol } from '/lib/types.ts';
|
||||
|
||||
let BASE_URL = typeof window !== 'undefined' && window.location
|
||||
? `${window.location.protocol}//${window.location.host}`
|
||||
: '';
|
||||
let CUSTOM_TITLE = '';
|
||||
let CUSTOM_DESCRIPTION = '';
|
||||
let HELP_EMAIL = '';
|
||||
|
||||
if (typeof Deno !== 'undefined') {
|
||||
await import('std/dotenv/load.ts');
|
||||
|
||||
BASE_URL = Deno.env.get('BASE_URL') || '';
|
||||
|
||||
CUSTOM_TITLE = Deno.env.get('CUSTOM_TITLE') || '';
|
||||
CUSTOM_DESCRIPTION = Deno.env.get('CUSTOM_DESCRIPTION') || '';
|
||||
HELP_EMAIL = Deno.env.get('HELP_EMAIL') || '';
|
||||
}
|
||||
|
||||
export const baseUrl = BASE_URL || 'http://localhost:8000';
|
||||
export const defaultTitle = CUSTOM_TITLE || 'bewCloud is a modern and simpler alternative to Nextcloud and ownCloud';
|
||||
export const defaultDescription = CUSTOM_DESCRIPTION || `Have your files under your own control.`;
|
||||
export const helpEmail = HELP_EMAIL;
|
||||
|
||||
export function isRunningLocally(request: Request): boolean {
|
||||
try {
|
||||
const url = new URL(request.url);
|
||||
|
||||
Reference in New Issue
Block a user