|
|
@@ -1,6 +1,11 @@
|
|
|
/**
|
|
|
* Post install script: create or replace the symlink .env
|
|
|
* to the .env file matching the current environment
|
|
|
+ *
|
|
|
+ * To force an hostname, define an env variable named HOST :
|
|
|
+ *
|
|
|
+ * HOST=ci node ./env/setupEnv.mjs
|
|
|
+ *
|
|
|
*/
|
|
|
import os from "os";
|
|
|
import fs from "fs";
|
|
|
@@ -10,7 +15,7 @@ import path from 'path';
|
|
|
|
|
|
const projectDir = path.join(path.dirname(fileURLToPath(import.meta.url)), '..')
|
|
|
|
|
|
-const hostname = os.hostname()
|
|
|
+const hostname = process.env.HOST ?? os.hostname()
|
|
|
|
|
|
const environments = {
|
|
|
'app': '.env.docker',
|
|
|
@@ -21,6 +26,7 @@ const environments = {
|
|
|
'test3': '.env.test3',
|
|
|
'test4': '.env.test4',
|
|
|
'test5': '.env.test5',
|
|
|
+ 'ci': '.env.ci',
|
|
|
}
|
|
|
|
|
|
if (!environments.hasOwnProperty(hostname)) {
|