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
Conversation
| const fs = require('fs'); | ||
| const path = require('path'); | ||
|
|
||
| const RELATIVE_FILE = 'server/config/local.json'; |
vladikoff
Sep 28, 2015
Contributor
Use path.join here
https://nodejs.org/docs/v0.10.0/api/path.html#path_path_join_path1_path2
Use path.join here
https://nodejs.org/docs/v0.10.0/api/path.html#path_path_join_path1_path2
| @@ -3,7 +3,7 @@ | |||
| "version": "0.46.0", | |||
| "description": "Firefox Accounts Content Server", | |||
| "scripts": { | |||
| "start": "grunt server", | |||
| "start": "node scripts/check-config && grunt server", | |||
vladikoff
Sep 28, 2015
Contributor
rename check-config to check-local-config so it is more descriptive
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)) { |
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:
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:
| var path = require('path'); | ||
|
|
||
| var RELATIVE_FILE = path.join('server', 'config', 'local.json'); | ||
|
|
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+.
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
|
@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
|
@npestana Excellent, thank you so much! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
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