adding in environment variables for electron
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
interface EnvironmentConfig {
|
||||
API_SERVER_URL: string;
|
||||
}
|
||||
|
||||
// keep private
|
||||
const getEnvironmentVariables = (): EnvironmentConfig => {
|
||||
// TODO
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
//
|
||||
return {
|
||||
API_SERVER_URL: 'https://api-a4b4we4n4q-wm.a.run.app/',
|
||||
};
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
//
|
||||
return {
|
||||
API_SERVER_URL: 'https://localhost:8080',
|
||||
};
|
||||
}
|
||||
|
||||
throw Error('No environment variables found!');
|
||||
};
|
||||
|
||||
export const environmentVariables: EnvironmentConfig = getEnvironmentVariables();
|
||||
@@ -1,6 +1,7 @@
|
||||
import { BrowserWindow, Display, app, ipcMain, screen } from 'electron';
|
||||
import Channels, { DEFAULT_APP_PRESET, DimensionChangeRequest } from './electron/constants';
|
||||
|
||||
import { environmentVariables } from './electron/config';
|
||||
import { handleGoogleLogin } from './electron/handleLogin';
|
||||
import path from 'path';
|
||||
import store from './electron/store';
|
||||
@@ -11,6 +12,9 @@ import store from './electron/store';
|
||||
declare const MAIN_WINDOW_WEBPACK_ENTRY: string;
|
||||
declare const MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY: string;
|
||||
|
||||
console.log(`is production ${app.isPackaged}`);
|
||||
console.log(`variables loaded`, environmentVariables);
|
||||
|
||||
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
|
||||
if (require('electron-squirrel-startup')) {
|
||||
// eslint-disable-line global-require
|
||||
|
||||
Reference in New Issue
Block a user