summaryrefslogtreecommitdiff
path: root/src/lib/config.ts
diff options
context:
space:
mode:
authorRaphael Kabo <raphaelkabo@hey.com>2023-10-06 16:25:29 +0100
committerRaphael Kabo <raphaelkabo@hey.com>2023-10-06 16:25:29 +0100
commit2996a4d05d0ea2f8446e2a2a0383979ceec748ae (patch)
treeaeab360ac4c1aa14f50b638f9b799dad8df55ff8 /src/lib/config.ts
parent115210bfd9a5ae7bb8b516ce0d2cf3d9042dead7 (diff)
Run Prettier on all files
Diffstat (limited to 'src/lib/config.ts')
-rw-r--r--src/lib/config.ts82
1 files changed, 41 insertions, 41 deletions
diff --git a/src/lib/config.ts b/src/lib/config.ts
index dc8e9c8..9577fd6 100644
--- a/src/lib/config.ts
+++ b/src/lib/config.ts
@@ -2,55 +2,55 @@ import fs from "fs";
import toml from "toml";
interface GathioConfig {
- general: {
- domain: string;
- port: string;
- email: string;
- site_name: string;
- is_federated: boolean;
- email_logo_url: string;
- show_kofi: boolean;
- mail_service: "nodemailer" | "sendgrid";
- };
- database: {
- mongodb_url: string;
- };
- nodemailer?: {
- smtp_server: string;
- smtp_port: string;
- smtp_username: string;
- smtp_password: string;
- };
- sendgrid?: {
- api_key: string;
- };
+ general: {
+ domain: string;
+ port: string;
+ email: string;
+ site_name: string;
+ is_federated: boolean;
+ email_logo_url: string;
+ show_kofi: boolean;
+ mail_service: "nodemailer" | "sendgrid";
+ };
+ database: {
+ mongodb_url: string;
+ };
+ nodemailer?: {
+ smtp_server: string;
+ smtp_port: string;
+ smtp_username: string;
+ smtp_password: string;
+ };
+ sendgrid?: {
+ api_key: string;
+ };
}
export const publicConfig = () => {
- const config = getConfig();
- return {
- domain: config.general.domain,
- siteName: config.general.site_name,
- isFederated: config.general.is_federated,
- emailLogoUrl: config.general.email_logo_url,
- showKofi: config.general.show_kofi,
- };
+ const config = getConfig();
+ return {
+ domain: config.general.domain,
+ siteName: config.general.site_name,
+ isFederated: config.general.is_federated,
+ emailLogoUrl: config.general.email_logo_url,
+ showKofi: config.general.show_kofi,
+ };
};
// Attempt to load our global config. Will stop the app if the config file
// cannot be read (there's no point trying to continue!)
export const getConfig = (): GathioConfig => {
- try {
- const config = toml.parse(
- fs.readFileSync("./config/config.toml", "utf-8")
- ) as GathioConfig;
- return config;
- } catch {
- console.error(
- "\x1b[31mConfiguration file not found! Have you renamed './config/config-example.toml' to './config/config.toml'?"
- );
- return process.exit(1);
- }
+ try {
+ const config = toml.parse(
+ fs.readFileSync("./config/config.toml", "utf-8"),
+ ) as GathioConfig;
+ return config;
+ } catch {
+ console.error(
+ "\x1b[31mConfiguration file not found! Have you renamed './config/config-example.toml' to './config/config.toml'?",
+ );
+ return process.exit(1);
+ }
};
export default getConfig;