mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-10-25 02:54:04 -05:00
Move Electron app entrypoint, handle launch errors
This commit is contained in:
24
src/common/globals.ts
Normal file
24
src/common/globals.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import * as path from 'node:path';
|
||||
import createDebug from 'debug';
|
||||
import dotenv from 'dotenv';
|
||||
import dotenvExpand from 'dotenv-expand';
|
||||
import { paths } from '../util/storage.js';
|
||||
|
||||
let done = false;
|
||||
|
||||
export function init() {
|
||||
if (done) {
|
||||
throw new Error('Attempted to initialise global data twice');
|
||||
}
|
||||
|
||||
done = true;
|
||||
|
||||
dotenvExpand.expand(dotenv.config({
|
||||
path: path.join(paths.data, '.env'),
|
||||
}));
|
||||
if (process.env.NXAPI_DATA_PATH) dotenvExpand.expand(dotenv.config({
|
||||
path: path.join(process.env.NXAPI_DATA_PATH, '.env'),
|
||||
}));
|
||||
|
||||
if (process.env.DEBUG) createDebug.enable(process.env.DEBUG);
|
||||
}
|
||||
Reference in New Issue
Block a user