Files
bewcloud/lib/config.ts
Bruno Bernardino 5a85dd224e Allow signing up forever without Brevo.
Also allow logins from local IPs (related to #5).
2024-04-08 20:53:28 +01:00

36 lines
844 B
TypeScript

import 'std/dotenv/load.ts';
import { isThereAnAdmin } from './data/user.ts';
export async function isSignupAllowed() {
const areSignupsAllowed = Deno.env.get('CONFIG_ALLOW_SIGNUPS') === 'true';
const areThereAdmins = await isThereAnAdmin();
if (areSignupsAllowed || !areThereAdmins) {
return true;
}
return false;
}
export function isEmailEnabled() {
const areEmailsAllowed = Deno.env.get('CONFIG_ENABLE_EMAILS') === 'true';
return areEmailsAllowed;
}
export function isForeverSignupEnabled() {
const areForeverAccountsEnabled = Deno.env.get('CONFIG_ENABLE_FOREVER_SIGNUP') === 'true';
return areForeverAccountsEnabled;
}
export function getFilesRootPath() {
const configRootPath = Deno.env.get('CONFIG_FILES_ROOT_PATH');
const filesRootPath = `${Deno.cwd()}/${configRootPath}`;
return filesRootPath;
}