Skip to content

Commit

Permalink
server: load env from scrypted volume
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Mar 22, 2024
1 parent 8dbf751 commit 35444f3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
16 changes: 14 additions & 2 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"adm-zip": "^0.5.12",
"body-parser": "^1.20.2",
"cookie-parser": "^1.4.6",
"dotenv": "^16.4.5",
"engine.io": "^6.5.4",
"express": "^4.19.1",
"follow-redirects": "^1.15.6",
Expand Down
7 changes: 7 additions & 0 deletions server/src/scrypted-main-exports.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import dns from 'dns';
import dotenv from 'dotenv';
import path from 'path';
import process from 'process';
import semver from 'semver';
import v8 from 'v8';
import vm from 'vm';
import { PluginError } from './plugin/plugin-error';
import { getScryptedVolume } from './plugin/plugin-volume';
import { RPCResultError, startPeriodicGarbageCollection } from './rpc';
import type { Runtime } from './scrypted-server-main';

Expand Down Expand Up @@ -54,6 +57,10 @@ function start(mainFilename: string, options?: {
console.warn('unhandled rejection of RPC Result', error);
});

dotenv.config({
path: path.join(getScryptedVolume(), '.env'),
});

const start = require('./scrypted-server-main').default;
return start(mainFilename, options);
}
Expand Down

0 comments on commit 35444f3

Please sign in to comment.