alfresco-content-app/scripts/app-config-replace.js
Maurizio Vitale b240909868
Use the e2e lite-serve (#1390)
* Enable liteserve Fix ecmHost Enable browser open

* Be able to pass a different admin credentials

* use the e2e liteserve

* sync package-lock

* Update webdriver

* Replace the app.conf values before running e2e. Be able to run e2e on external env

* Remove dist mystake

* Remove the baseUrl from the contains

* Use the docker image

* stop postgresql before install

* Try the new strategy

* regenerate the package lock

* Wait for the content to go up

* Change travis with start.sh

* do not override the baseUrl

* Create a different docker compose for e2e

Co-authored-by: Adina Parpalita <adina.parpalita@ness.com>
2020-04-02 09:21:44 +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_HOST = process.env.API_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_HOST",
set: appConfig => {
appConfig.ecmHost = API_HOST;
appConfig.aosHost = API_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);
fs.writeFileSync(program.config, appConfigReplacedJson);
});