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,11 +1,11 @@
|
||||
import 'std/dotenv/load.ts';
|
||||
|
||||
import { helpEmail } from '/lib/utils/misc.ts';
|
||||
import { AppConfig } from '/lib/config.ts';
|
||||
|
||||
const BREVO_API_KEY = Deno.env.get('BREVO_API_KEY') || '';
|
||||
|
||||
enum BrevoTemplateId {
|
||||
BEWCLOUD_VERIFY_EMAIL = 20,
|
||||
BEWCLOUD_VERIFY_EMAIL = 20, // NOTE: This will likely be different in your own Brevo account
|
||||
}
|
||||
|
||||
interface BrevoResponse {
|
||||
@@ -43,6 +43,9 @@ async function sendEmailWithTemplate(
|
||||
attachments: BrevoRequestBody['attachment'] = [],
|
||||
cc?: string,
|
||||
) {
|
||||
const config = await AppConfig.getConfig();
|
||||
const helpEmail = config.visuals.helpEmail;
|
||||
|
||||
const email: BrevoRequestBody = {
|
||||
templateId,
|
||||
params: data,
|
||||
|
||||
Reference in New Issue
Block a user