alfresco-content-app/scripts/app-config-replace.js
Denys Vuika 2854c17cd9
[ADF-5183] Upgrade to Angular 10 (#1506)
* upgrade preparation fixes

* remove fdescribe

* update browserlist config

* ng8

* ngrx 8

* ng9

* ngrx 9

* remove entryComponents

* unit tests

* ng 10

* latest ADF

* fix unit tests

* fix lint

* update deps and travis

* code fixes

* upgrade webdriver

* cleanup libs

* fix test

* update test

* Use browserTarget as target for lite-serve

* Use the update webdriver with CI condition

* Use version console.log('load', path

* Fix path sh

* Try to use remote env

* Add the . to export variabled

* Use hardcoded chrome version

* Remove the run remote

* Avoid to use the escape

* Skip flaky e2e and raise issue ACA-3615

* SKip failing e2e

* Skip flaky e2e and raise issue ACA-3615

* Fix close app toolbar menu and preconditions + tests of  mark-favorite.test.ts  Personal Files section

* Fix mark-favorite tests

* Fix ext-header test

* Fix new-menu tests

* Fix lint

* no message

* Fix viewer tests

Co-authored-by: maurizio vitale <maurizio.vitale@alfresco.com>
Co-authored-by: Cristina Jalba <cristina.jalba@ness.com>
2020-07-09 09:37:06 +01:00

55 lines
1.4 KiB
JavaScript
Executable File

#!/usr/bin/env node
const program = require('commander');
require('dotenv').config({ path: process.env.ENV_FILE });
const fs = require('fs');
const API_CONTENT_HOST = process.env.API_CONTENT_HOST || 'api';
const OAUTH_HOST = process.env.OAUTH_HOST || 'keycloak';
const options = {
apiHost: {
flags: '-a, --api-host',
description: "set apiHost's and ecmHost's value with API_CONTENT_HOST",
set: appConfig => {
appConfig.ecmHost = API_CONTENT_HOST;
appConfig.aosHost = API_CONTENT_HOST + '/alfresco/aos';
}
},
oauthHost: {
flags: '-o, --oauth-host',
description: "set oauth2.host's value with OAUTH_HOST",
set: appConfig => {
appConfig.authType = 'OAUTH';
appConfig.oauth2.host = OAUTH_HOST;
}
}
};
program
.version('0.0.1')
.requiredOption(
'-c, --config <path>',
'path to the app.config.json to reset its values with env vars'
);
Object.keys(options).forEach(option => {
program.option(options[option].flags, options[option].description);
});
program.parse(process.argv);
fs.readFile(program.config, (err, appConfigString) => {
if (err) throw err;
let appConfig = JSON.parse(appConfigString);
Object.keys(options).forEach(option => {
if (program[option]) {
options[option].set(appConfig);
}
});
let appConfigReplacedJson = JSON.stringify(appConfig, null, 4);
fs.writeFileSync(program.config, appConfigReplacedJson);
});