diff options
| author | Raphael Kabo <raphaelkabo@hey.com> | 2023-10-09 10:48:10 +0100 | 
|---|---|---|
| committer | Raphael Kabo <raphaelkabo@hey.com> | 2023-10-09 10:48:10 +0100 | 
| commit | 8b33335584afbac74388c4ed16ff1ff7a04e3588 (patch) | |
| tree | bc35e2e96695a56780139856dfd1f5267546193f /src/lib | |
| parent | 8a1f07b11e8e18243c058149ac58ece7766b7ef3 (diff) | |
Add static page config and handler
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/config.ts | 23 | 
1 files changed, 22 insertions, 1 deletions
diff --git a/src/lib/config.ts b/src/lib/config.ts index 7b35b98..7366b59 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -2,6 +2,12 @@ import fs from "fs";  import toml from "toml";  import { exitWithError } from "./process.js"; +interface StaticPage { +    title: string; +    path: string; +    filename: string; +} +  interface GathioConfig {      general: {          domain: string; @@ -25,9 +31,21 @@ interface GathioConfig {      sendgrid?: {          api_key: string;      }; +    static_pages: StaticPage[]; +} + +interface FrontendConfig { +    domain: string; +    siteName: string; +    isFederated: boolean; +    emailLogoUrl: string; +    showKofi: boolean; +    showInstanceInformation: boolean; +    staticPages: StaticPage[]; +    version: string;  } -export const publicConfig = () => { +export const frontendConfig = (): FrontendConfig => {      const config = getConfig();      return {          domain: config.general.domain, @@ -35,6 +53,9 @@ export const publicConfig = () => {          isFederated: config.general.is_federated,          emailLogoUrl: config.general.email_logo_url,          showKofi: config.general.show_kofi, +        showInstanceInformation: config.static_pages.length > 0, +        staticPages: config.static_pages, +        version: process.env.npm_package_version || "unknown",      };  };  | 
