Merge pull request #642 from bitjson/feature/external-services-via-env-var
Configure external services via environment variable
This commit is contained in:
commit
b3bfc1e6df
4 changed files with 43 additions and 14 deletions
|
|
@ -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,9 +82,22 @@ fs.writeFileSync('../appConfig.json', configBlob, 'utf8');
|
|||
////////////////
|
||||
var externalServices;
|
||||
try {
|
||||
console.log('Copying ' + configDir + '/externalServices.json' + ' to root');
|
||||
externalServices = fs.readFileSync(configDir + '/externalServices.json', 'utf8');
|
||||
var confName = configDir.toUpperCase();
|
||||
var externalServicesConf = confName + '_EXTERNAL_SERVICES_CONFIG_LOCATION';
|
||||
console.log('Looking for ' + externalServicesConf + '...');
|
||||
if(typeof process.env[externalServicesConf] !== 'undefined') {
|
||||
var location = process.env[externalServicesConf]
|
||||
if(location.charAt(0) === '~') {
|
||||
location = location.replace(/^\~/, process.env.HOME || process.env.USERPROFILE);
|
||||
}
|
||||
console.log('Found at: ' + location);
|
||||
console.log('Copying ' + location + ' to root');
|
||||
externalServices = fs.readFileSync(location, 'utf8');
|
||||
} else {
|
||||
throw externalServicesConf + ' environment variable not set.';
|
||||
}
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
externalServices = '{}';
|
||||
console.log('External services not configured');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
@ -102,8 +101,8 @@
|
|||
"run:android": "cordova run android --device",
|
||||
"log:android": "adb logcat | grep chromium",
|
||||
"sign:android": "rm -f platforms/android/build/outputs/apk/android-release-signed-aligned.apk; jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../copay.keystore -signedjar platforms/android/build/outputs/apk/android-release-signed.apk platforms/android/build/outputs/apk/android-release-unsigned.apk copay_play && ../android-sdk-macosx/build-tools/21.1.1/zipalign -v 4 platforms/android/build/outputs/apk/android-release-signed.apk platforms/android/build/outputs/apk/android-release-signed-aligned.apk",
|
||||
"apply:copay": "cd app-template && node apply.js copay && cordova prepare",
|
||||
"apply:bitpay": "cd app-template && node apply.js bitpay && cordova prepare",
|
||||
"apply:copay": "npm i && cd app-template && node apply.js copay && cordova prepare",
|
||||
"apply:bitpay": "npm i && cd app-template && node apply.js bitpay && cordova prepare",
|
||||
"test": "./node_modules/.bin/grunt test-coveralls",
|
||||
"clean": "trash platforms && trash plugins && cordova prepare",
|
||||
"unstage-package": "git reset package.json",
|
||||
Loading…
Add table
Add a link
Reference in a new issue