aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--next.config.js8
-rw-r--r--pages/index.tsx10
-rw-r--r--utils/env.tsx19
3 files changed, 25 insertions, 12 deletions
diff --git a/next.config.js b/next.config.js
index 0d49eb4..05e4425 100644
--- a/next.config.js
+++ b/next.config.js
@@ -1,11 +1,11 @@
const path = require('path');
const { withMarkdownLoader } = require('./plugins');
-const DISPLAY_DOMAIN = process.env.DISPLAY_DOMAIN;
+const SITE_DOMAIN = process.env.SITE_DOMAIN;
-if(!DISPLAY_DOMAIN) throw Error("Please define a display domain");
+if(!SITE_DOMAIN) throw Error("Please define a display domain");
-const exportDir = `export/${DISPLAY_DOMAIN}`;
+const exportDir = `export/${SITE_DOMAIN}`;
module.exports = () => {
const plugins = [
@@ -20,7 +20,7 @@ module.exports = () => {
includePaths: [path.join(__dirname, 'styles')]
},
env: {
- DISPLAY_DOMAIN: DISPLAY_DOMAIN,
+ SITE_DOMAIN: SITE_DOMAIN,
},
output: 'export',
distDir: exportDir,
diff --git a/pages/index.tsx b/pages/index.tsx
index 72e22b8..029666c 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -9,20 +9,20 @@ import Code from '../components/Code';
import md from './greeting.md';
import { List, ListItem } from '../components/List';
-import { DISPLAY_DOMAIN } from '../utils/env';
+import { DISPLAY_DOMAIN, SiteDomain, SITE_DOMAIN } from '../utils/env';
export default function Home() {
- const gitLink = 'https://git.al.' + DISPLAY_DOMAIN;
+ const gitLink = 'https://git.' + DISPLAY_DOMAIN;
let email : string;
- switch(DISPLAY_DOMAIN) {
- case "flu0r1ne.net":
+ switch(SITE_DOMAIN) {
+ case SiteDomain.FLU0R1NENET:
email = "flu0r1ne [at] flu0r1ne.net";
break;
- case "exander.io":
+ case SiteDomain.EXANDERIO:
email = "alex [at] al.exander.io";
break;
default:
diff --git a/utils/env.tsx b/utils/env.tsx
index 1894c1b..fe56701 100644
--- a/utils/env.tsx
+++ b/utils/env.tsx
@@ -1,9 +1,22 @@
import assert from './assert';
-const DISPLAY_DOMAIN = process.env.DISPLAY_DOMAIN;
+const SITE_DOMAIN = process.env.SITE_DOMAIN;
-assert(DISPLAY_DOMAIN !== undefined, 'Please set DISPLAY_DOMAIN');
+enum SiteDomain {
+ EXANDERIO = "exander.io",
+ FLU0R1NENET = "flu0r1ne.net"
+};
+
+assert(
+ SITE_DOMAIN === SiteDomain.EXANDERIO ||
+ SITE_DOMAIN === SiteDomain.FLU0R1NENET,
+ `Please set SITE_DOMAIN`
+);
+
+const DISPLAY_DOMAIN = SITE_DOMAIN === SiteDomain.EXANDERIO ? 'al.exander.io' : 'flu0r1ne.net';
export {
- DISPLAY_DOMAIN
+ SITE_DOMAIN,
+ SiteDomain,
+ DISPLAY_DOMAIN,
};