Skip to content
This repository has been archived by the owner. It is now read-only.

fix(config): copy 'local.json-dist' to 'local.json' if it don't exists #3115

Merged
merged 1 commit into from Sep 28, 2015

Conversation

@npestana
Copy link
Member

@npestana npestana commented Sep 28, 2015

Create 'scripts/check-config.js' to check if 'local.json' don't exists.
This script will run on 'npm start' before 'grant server'.

Closes #2619

@vladikoff vladikoff self-assigned this Sep 28, 2015
const fs = require('fs');
const path = require('path');

const RELATIVE_FILE = 'server/config/local.json';
@@ -3,7 +3,7 @@
"version": "0.46.0",
"description": "Firefox Accounts Content Server",
"scripts": {
"start": "grunt server",
"start": "node scripts/check-config && grunt server",

This comment has been minimized.

@vladikoff

vladikoff Sep 28, 2015
Contributor

rename check-config to check-local-config so it is more descriptive

const RELATIVE_FILE = 'server/config/local.json';
const CONFIG_FILE = path.resolve(__dirname, '..', RELATIVE_FILE);

if (!fs.existsSync(CONFIG_FILE)) {

This comment has been minimized.

@vladikoff

vladikoff Sep 28, 2015
Contributor

Here also check if process.env.CONFIG_FILES exists.
if it exists (defined) then do not copy the local.json file. This is an extra precaution, CONFIG_FILES var overrides everything else

See similar example here:

// Config files specified in CONFIG_FILES env variable override everything

var path = require('path');

var RELATIVE_FILE = path.join('server', 'config', 'local.json');

This comment has been minimized.

@vladikoff

vladikoff Sep 28, 2015
Contributor

Nice! this looks like it ready to go!

Squash the 2 commits into one and remove this extra line break while you are at it.

R+.

Create 'scripts/check-local-config.js' to check if 'local.json' don't exists.
This script will run on 'npm start' before 'grant server'.

Closes #2619
@npestana npestana force-pushed the npestana:i2619-local-json branch from 0d357e6 to 0eefb94 Sep 28, 2015
@npestana
Copy link
Member Author

@npestana npestana commented Sep 28, 2015

@vladikoff line break removed and commits squashed.

vladikoff added a commit that referenced this pull request Sep 28, 2015
fix(config): copy 'local.json-dist' to 'local.json' if it don't exists r=vladikoff
@vladikoff vladikoff merged commit 3d7fa00 into mozilla:master Sep 28, 2015
1 of 3 checks passed
1 of 3 checks passed
ci/circleci CircleCI is running your tests
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
coverage/coveralls Coverage remained the same at 98.897%
Details
@vladikoff
Copy link
Contributor

@vladikoff vladikoff commented Sep 28, 2015

@npestana Excellent, thank you so much!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants