Introduce isStagingServer util method

This commit is contained in:
Fedor Indutny 2024-09-04 11:12:45 -07:00 committed by GitHub
parent 4cdb6fab08
commit cd44a7a033
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 80 additions and 71 deletions

View file

@ -15,7 +15,7 @@ import {
// In production mode, NODE_ENV cannot be customized by the user
if (app.isPackaged) {
setEnvironment(Environment.Production, false);
setEnvironment(Environment.PackagedApp, false);
} else {
setEnvironment(
parseEnvironment(process.env.NODE_ENV || 'development'),
@ -27,7 +27,7 @@ if (app.isPackaged) {
process.env.NODE_ENV = getEnvironment();
process.env.NODE_CONFIG_DIR = join(__dirname, '..', 'config');
if (getEnvironment() === Environment.Production) {
if (getEnvironment() === Environment.PackagedApp) {
// harden production config against the local env
process.env.NODE_CONFIG = '';
process.env.NODE_CONFIG_STRICT_MODE = '';
@ -47,7 +47,7 @@ if (getEnvironment() === Environment.Production) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const config: IConfig = require('config');
if (getEnvironment() !== Environment.Production) {
if (getEnvironment() !== Environment.PackagedApp) {
config.util.getConfigSources().forEach(source => {
console.log(`config: Using config source ${basename(source.name)}`);
});