loading the right environment variables and getting through main process
This commit is contained in:
@@ -19,7 +19,9 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"config": {
|
"config": {
|
||||||
"forge": {
|
"forge": {
|
||||||
"packagerConfig": {},
|
"packagerConfig": {
|
||||||
|
"test": "test"
|
||||||
|
},
|
||||||
"makers": [
|
"makers": [
|
||||||
{
|
{
|
||||||
"name": "@electron-forge/maker-squirrel",
|
"name": "@electron-forge/maker-squirrel",
|
||||||
|
|||||||
@@ -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, systemPreferences } from 'electron';
|
import { BrowserWindow, Display, app, ipcMain, screen, systemPreferences } from 'electron';
|
||||||
import Channels, { DEFAULT_APP_PRESET, DimensionChangeRequest } from './electron/constants';
|
import Channels, { DEFAULT_APP_PRESET, DimensionChangeRequest } from './electron/constants';
|
||||||
|
|
||||||
|
import { environmentVariables } from './electron/config';
|
||||||
import { handleGoogleLogin } from './electron/handleLogin';
|
import { handleGoogleLogin } from './electron/handleLogin';
|
||||||
import store from './electron/store';
|
import store from './electron/store';
|
||||||
|
|
||||||
@@ -10,11 +11,15 @@ import store from './electron/store';
|
|||||||
declare const MAIN_WINDOW_WEBPACK_ENTRY: string;
|
declare const MAIN_WINDOW_WEBPACK_ENTRY: string;
|
||||||
declare const MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY: string;
|
declare const MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY: string;
|
||||||
|
|
||||||
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
|
console.log(`is production ${app.isPackaged}`);
|
||||||
if (require('electron-squirrel-startup')) {
|
console.log(`variables loaded`, environmentVariables);
|
||||||
// eslint-disable-line global-require
|
|
||||||
app.quit();
|
if (process.env.NODE_ENV)
|
||||||
}
|
if (require('electron-squirrel-startup')) {
|
||||||
|
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
|
||||||
|
// eslint-disable-line global-require
|
||||||
|
app.quit();
|
||||||
|
}
|
||||||
|
|
||||||
// Keep a global reference of the window object, if you don't, the window will
|
// Keep a global reference of the window object, if you don't, the window will
|
||||||
// be closed automatically when the JavaScript object is garbage collected.
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import NirvanaLogo from '../components/NirvanaLogo';
|
|||||||
import { User } from '@nirvana/core/src/models/user.model';
|
import { User } from '@nirvana/core/src/models/user.model';
|
||||||
import { blueGrey } from '@mui/material/colors';
|
import { blueGrey } from '@mui/material/colors';
|
||||||
import { firebaseAuth } from '../firebase/connect';
|
import { firebaseAuth } from '../firebase/connect';
|
||||||
|
import { useMount } from 'react-use';
|
||||||
import { useSnackbar } from 'notistack';
|
import { useSnackbar } from 'notistack';
|
||||||
|
|
||||||
interface IAuthContext {
|
interface IAuthContext {
|
||||||
|
|||||||
Reference in New Issue
Block a user