Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check for local config over dev config #1422

Merged
merged 1 commit into from
Jul 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/**/*
config-local.json
desktop-build/
dist/
release/
Expand Down
14 changes: 13 additions & 1 deletion get-config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
function readLocalConfig() {
try {
const config = require('./config-local');
if (typeof config === 'function') {
throw new Error('Invalid config file. Config must be JSON.');
}
return config;
} catch {
return false;
}
}

function readConfig() {
try {
const config = require('./config');
Expand All @@ -17,7 +29,7 @@ function readConfig() {
}

function getConfig() {
var config = readConfig();
var config = readLocalConfig() || readConfig();
var pkg = require('./package.json');
config.version = pkg.version;
return config;
Expand Down