feature(externalServices): apply external services configuration via environment variable --no-verify

This commit is contained in:
Jason Dreyzehner 2016-10-21 12:01:29 -04:00
parent e1f36227b1
commit 819e977ae3
4 changed files with 27 additions and 12 deletions

View File

@ -133,6 +133,16 @@ npm run final:desktop
On success, the Chrome extension will be located at: `browser-extensions/chrome/copay-chrome-extension`. To install it go to `chrome://extensions/` in your browser and ensure you have the 'developer mode' option enabled in the settings. Then click on "Load unpacked chrome extension" and choose the directory mentioned above.
## Configuration
### Enable External Services
To enable external services, set the `COPAY_EXTERNAL_SERVICES_CONFIG_LOCATION` environment variable to the location of your configuration before running the `apply` task.
```sh
export COPAY_EXTERNAL_SERVICES_CONFIG_LOCATION="~/.copay/externalServices.json"
```
## About Copay
### General

View File

@ -5,7 +5,7 @@
//
var templates = {
'package.json': '/',
'package-template.json': '/',
'index.html': 'www/',
'Makefile': 'cordova/',
'ProjectMakefile': 'cordova/',
@ -64,6 +64,8 @@ Object.keys(templates).forEach(function(k) {
if(k === 'config-template.xml'){
k = 'config.xml';
} else if (k === 'package-template.json') {
k = 'package.json';
}
if (!fs.existsSync('../' + targetDir)){
@ -80,8 +82,11 @@ fs.writeFileSync('../appConfig.json', configBlob, 'utf8');
////////////////
var externalServices;
try {
console.log('Copying ' + configDir + '/externalServices.json' + ' to root');
externalServices = fs.readFileSync(configDir + '/externalServices.json', 'utf8');
if(typeof process.env.COPAY_EXTERNAL_SERVICES_CONFIG_LOCATION !== 'undefined') {
var location = process.env.COPAY_EXTERNAL_SERVICES_CONFIG_LOCATION;
console.log('Copying ' + location + ' to root');
externalServices = fs.readFileSync(location, 'utf8');
}
} catch(err) {
externalServices = '{}';
console.log('External services not configured');

View File

@ -79,8 +79,7 @@
"shelljs": "^0.3.0"
},
"scripts": {
"postinstall": "bower install && npm run postapply",
"postapply": "echo && echo \"To finish, choose a distribution by running 'npm run apply:copay' or 'npm run apply:bitpay'.\" && echo",
"postinstall": "bower install",
"start": "npm run build:www && ionic serve --nolivereload --nogulp -s",
"start:ios": "npm run build:www && npm run build:ios && npm run open:ios",
"start:android": "npm run build:www && npm run build:android && npm run run:android",

View File

@ -1,20 +1,21 @@
{
"changes": "changes to this file can be commited with the --no-verify option",
"name": "distribution-not-selected",
"description": "Choose a distribution by running 'npm run apply:copay' or 'npm run apply:bitpay'.",
"primary-package-json": "See the tempate in app-template/package.json",
"scripts": {
"postinstall": "npm run apply:copay",
"postinstall": "npm run apply:copay && echo && echo \"Repo configured for standard Copay distribution. To switch to the BitPay distribution, run 'npm run apply:bitpay'.\" && echo",
"start": "echo && echo \"Choose a distribution by running 'npm run apply:copay' or 'npm run apply:bitpay'.\" && echo",
"preapply": "npm i fs-extra",
"apply:copay": "npm run preapply && cd app-template && node apply.js copay && cd .. && npm i && npm run postapply",
"apply:bitpay": "npm run preapply && cd app-template && node apply.js bitpay && cd .. && npm i && npm run postapply",
"apply:copay": "cd app-template && node apply.js copay && cd .. && npm i && npm run postapply",
"apply:bitpay": "cd app-template && node apply.js bitpay && cd .. && npm i && npm run postapply",
"clean-all": "git clean -dfx"
},
"dependencies": {
"fs-extra": "^0.30.0"
},
"license": "MIT",
"repository": {
"url": "git://github.com/bitpay/copay.git",
"url": "git://github.com/bitpay/bitpay-wallet.git",
"type": "git"
},
"changes": "changes to this file can be commited with the --no-verify option"
}
}