[ACA-4715] break dependency on envsubst (#3325)

* remove BPM host

* break dependency on envsubst

* remove prebuild script

* cleanup package.json
This commit is contained in:
Denys Vuika 2023-07-11 08:39:17 +01:00 committed by GitHub
parent f54ba92f77
commit 7ab4cc5e53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 21 additions and 231 deletions

View File

@ -32,7 +32,7 @@ runs:
steps:
- name: Check content UP
shell: bash
run: ./node_modules/@alfresco/adf-cli/bin/adf-cli check-cs-env --host $APP_CONFIG_ECM_HOST -u $ADMIN_EMAIL -p $ADMIN_PASSWORD || exit 1
run: ./node_modules/@alfresco/adf-cli/bin/adf-cli check-cs-env --host $BASE_URL -u $ADMIN_EMAIL -p $ADMIN_PASSWORD || exit 1
- name: Download artifacts
uses: ./.github/actions/download-job-artifact
@ -43,18 +43,6 @@ runs:
aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
aws-region: ${{ inputs.aws-region }}
- name: Replace variables in app.config.json
shell: bash
run: |
APP_CONFIG_FILE_PATH="${{ inputs.to }}/app.config.json"
npx envsub --all $APP_CONFIG_FILE_PATH $APP_CONFIG_FILE_PATH || exit 1
echo -n " \_ Validating replaced config file ... ";
npx ajv validate -s ./node_modules/@alfresco/adf-core/app.config.schema.json -d $APP_CONFIG_FILE_PATH --errors=text --verbose || exit 4
if grep -E -q '\$\{[A-Z0-9_]*\}' $APP_CONFIG_FILE_PATH; then
echo -e "\e[31m \_ ERROR: Variables are still present in the app.config.json file. Some of them might not have default value set.\e[0m";
exit 5;
fi
- name: Update webdriver-manager
shell: bash
run: |

View File

@ -22,12 +22,6 @@ runs:
- name: Setup and run with options
shell: bash
run: |
# npx http-server -c-1 $CONTENT_CE_DIST_PATH -p 4200 > /dev/null &\
{
echo "APP_CONFIG_ECM_HOST={protocol}//{hostname}{:port}"
} >> .env
npm start > /dev/null &\
echo "Running playwright tests with options ${{ inputs.options }}"

View File

@ -23,12 +23,6 @@ runs:
shell: bash
run: |
./node_modules/.bin/tsc -p "./e2e/protractor/$E2E_TSCONFIG" || exit 1;
# npx http-server -c-1 $CONTENT_CE_DIST_PATH -p 4200 > /dev/null &\
{
echo "APP_CONFIG_ECM_HOST={protocol}//{hostname}{:port}"
} >> .env
npm start > /dev/null &\
if [ ${{ inputs.test-runner }} == "playwright" ]; then

View File

@ -10,7 +10,7 @@ concurrency:
cancel-in-progress: true
env:
APP_CONFIG_ECM_HOST: ${{ secrets.PIPELINE_ENV_URL }}
BASE_URL: ${{ secrets.PIPELINE_ENV_URL }}
ADMIN_EMAIL: ${{ secrets.PIPELINE_ADMIN_USERNAME }}
ADMIN_PASSWORD: ${{ secrets.PIPELINE_ADMIN_PASSWORD }}
HR_USER: ${{ secrets.HR_USER }}

View File

@ -14,7 +14,7 @@ on:
- develop
env:
APP_CONFIG_ECM_HOST: ${{ secrets.PIPELINE_ENV_URL }}
BASE_URL: ${{ secrets.PIPELINE_ENV_URL }}
ADMIN_EMAIL: ${{ secrets.PIPELINE_ADMIN_USERNAME }}
ADMIN_PASSWORD: ${{ secrets.PIPELINE_ADMIN_PASSWORD }}
AWS_REGION: "eu-west-2"
@ -22,7 +22,6 @@ env:
PLAYWRIGHT_E2E_HOST: ${{ secrets.PLAYWRIGHT_E2E_HOST }}
NPM_REGISTRY_ADDRESS: ${{ secrets.NPM_REGISTRY_ADDRESS }}
jobs:
publish-docker-registry:
name: "Publish to Quay"

View File

@ -18,9 +18,6 @@ USER 101
ARG PROJECT_NAME
ENV APP_CONFIG_BPM_HOST="{protocol}//{hostname}{:port}"
ENV APP_CONFIG_ECM_HOST="{protocol}//{hostname}{:port}"
COPY docker/default.conf.template /etc/nginx/templates/
COPY dist/$PROJECT_NAME /usr/share/nginx/html/

View File

@ -25,7 +25,7 @@ Please refer to the public [documentation](https://alfresco-content-app.netlify.
Create an `.env` file in the project root folder with the following content
```yml
APP_CONFIG_ECM_HOST="<URL>"
BASE_URL="<URL>"
```
Where `<URL>` is the address of the ACS.

View File

@ -33,9 +33,9 @@
"app/src/assets",
"app/src/favicon-96x96.png",
{
"input": "app/.tmp",
"output": "/",
"glob": "app.config.json"
"glob": "app.config.json",
"input": "app/src",
"output": "/"
},
{
"glob": "**/*",

View File

@ -1,10 +1,10 @@
require('@alfresco/adf-cli/tooling').dotenvConfig({ path: process.env.ENV_FILE });
const APP_CONFIG_ECM_HOST = process.env.APP_CONFIG_ECM_HOST;
const { BASE_URL } = process.env;
module.exports = {
"/alfresco": {
"target": APP_CONFIG_ECM_HOST,
"target": BASE_URL,
"secure": false,
"pathRewrite": {
"^/alfresco/alfresco": ""
@ -13,7 +13,7 @@ module.exports = {
'logLevel': 'debug',
onProxyReq: function(request) {
if(request["method"] !== "GET")
request.setHeader("origin", APP_CONFIG_ECM_HOST);
request.setHeader("origin", BASE_URL);
},
// workaround for REPO-2260
onProxyRes: function (proxyRes) {

View File

@ -1,8 +1,8 @@
{
"$schema": "../node_modules/@alfresco/adf-core/app.config.schema.json",
"ecmHost": "${APP_CONFIG_ECM_HOST}",
"aosHost": "${APP_CONFIG_ECM_HOST}/alfresco/aos",
"baseShareUrl": "${APP_CONFIG_ECM_HOST}/#/preview/s",
"ecmHost": "{protocol}//{hostname}{:port}",
"aosHost": "{protocol}//{hostname}{:port}/alfresco/aos",
"baseShareUrl": "{protocol}//{hostname}{:port}/#/preview/s",
"providers": "ECM",
"authType": "BASIC",
"loginRoute": "login",

View File

@ -3,10 +3,6 @@
set -e
eval ALL_ARGUMENTS=("BASE_PATH"
"APP_BASE_SHARE_URL"
"APP_CONFIG_IDENTITY_HOST"
"APP_CONFIG_BPM_HOST"
"APP_CONFIG_ECM_HOST"
)
ALL_ARGUMENTS_LENGTH=${#ALL_ARGUMENTS[@]}
DOCKER_ARGS=""

View File

@ -34,7 +34,7 @@ You need to set some environment variables to be able to run the local dev serve
```yml
# App config settings
APP_CONFIG_ECM_HOST="<URL>"
BASE_URL="<URL>"
```
## Proxy settings

174
package-lock.json generated
View File

@ -76,7 +76,6 @@
"cypress": "^12.14.0",
"dotenv": "8.2.0",
"dotenv-expand": "^5.1.0",
"envsub": "^4.1.0",
"eslint": "^8.42.0",
"eslint-plugin-ban": "^1.6.0",
"eslint-plugin-import": "2.27.5",
@ -13046,102 +13045,6 @@
"node": ">=6"
}
},
"node_modules/envsub": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/envsub/-/envsub-4.1.0.tgz",
"integrity": "sha512-B44hta3xNFu6+zDhOha1TIrZkQHGDO3G5K8D2sJIkm/s3XyQjxWBGp1B+b/Y74Go1PqMP+cp8moPR4JullnD9Q==",
"dev": true,
"dependencies": {
"bluebird": "^3.7.2",
"chalk": "^3.0.0",
"commander": "^4.0.1",
"diff": "^4.0.1",
"handlebars": "^4.5.3",
"lodash": "^4.17.15",
"replace-last": "^1.2.6",
"string.prototype.matchall": "^4.0.8"
},
"bin": {
"envsub": "bin/envsub.js",
"envsubh": "bin/envsubh.js"
}
},
"node_modules/envsub/node_modules/ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"dependencies": {
"color-convert": "^2.0.1"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/envsub/node_modules/chalk": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz",
"integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==",
"dev": true,
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/envsub/node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"dependencies": {
"color-name": "~1.1.4"
},
"engines": {
"node": ">=7.0.0"
}
},
"node_modules/envsub/node_modules/color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
"node_modules/envsub/node_modules/commander": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
"integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==",
"dev": true,
"engines": {
"node": ">= 6"
}
},
"node_modules/envsub/node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/envsub/node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"dependencies": {
"has-flag": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/errno": {
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz",
@ -15857,36 +15760,6 @@
"integrity": "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==",
"dev": true
},
"node_modules/handlebars": {
"version": "4.7.7",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz",
"integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==",
"dev": true,
"dependencies": {
"minimist": "^1.2.5",
"neo-async": "^2.6.0",
"source-map": "^0.6.1",
"wordwrap": "^1.0.0"
},
"bin": {
"handlebars": "bin/handlebars"
},
"engines": {
"node": ">=0.4.7"
},
"optionalDependencies": {
"uglify-js": "^3.1.4"
}
},
"node_modules/handlebars/node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
@ -26754,15 +26627,6 @@
"node": ">=0.10"
}
},
"node_modules/replace-last": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/replace-last/-/replace-last-1.2.6.tgz",
"integrity": "sha512-Cj+MK38VtNu1S5J73mEZY3ciQb9dJajNq1Q8inP4dn/MhJMjHwoAF3Z3FjspwAEV9pfABl565MQucmrjOkty4g==",
"dev": true,
"engines": {
"node": ">= 4.0.0"
}
},
"node_modules/request": {
"version": "2.88.2",
"resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
@ -28201,25 +28065,6 @@
"node": ">=8"
}
},
"node_modules/string.prototype.matchall": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.8.tgz",
"integrity": "sha512-6zOCOcJ+RJAQshcTvXPHoxoQGONa3e/Lqx90wUA+wEzX78sg5Bo+1tQo4N0pohS0erG9qtCqJDjNCQBjeWVxyg==",
"dev": true,
"dependencies": {
"call-bind": "^1.0.2",
"define-properties": "^1.1.4",
"es-abstract": "^1.20.4",
"get-intrinsic": "^1.1.3",
"has-symbols": "^1.0.3",
"internal-slot": "^1.0.3",
"regexp.prototype.flags": "^1.4.3",
"side-channel": "^1.0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/string.prototype.trim": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz",
@ -29669,19 +29514,6 @@
"node": "*"
}
},
"node_modules/uglify-js": {
"version": "3.17.4",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz",
"integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==",
"dev": true,
"optional": true,
"bin": {
"uglifyjs": "bin/uglifyjs"
},
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/unbox-primitive": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz",
@ -30628,12 +30460,6 @@
"node": ">=0.10.0"
}
},
"node_modules/wordwrap": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
"integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=",
"dev": true
},
"node_modules/wrap-ansi": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",

View File

@ -1,17 +1,12 @@
{
"name": "alfresco-content-app",
"version": "4.1.0",
"commit": "",
"license": "LGPL-3.0",
"scripts": {
"postinstall": "ngcc",
"ng": "ng",
"validate-app-config": "ajv validate -s ./node_modules/@alfresco/adf-core/app.config.schema.json -d ./app/.tmp/app.config.json --errors=text --verbose",
"assemble-app-config": "envsub --env-file ./.env --env APP_CONFIG_ECM_HOST={protocol}//{hostname}{:port} --all ./app/src/app.config.json.tpl ./app/.tmp/app.config.json",
"prestart": "mkdir -p ./app/.tmp && npm run assemble-app-config && npm run validate-app-config",
"start": "nx serve content-ce",
"start:prod": "npm run validate-app-config && node --max-old-space-size=8192 nx serve content-ce --configuration production",
"prebuild": "mkdir -p ./app/.tmp && cp ./app/src/app.config.json.tpl ./app/.tmp/app.config.json",
"start:prod": "node --max-old-space-size=8192 nx serve content-ce --configuration production",
"build": "nx build content-ce",
"build.release": "npm run build -- --configuration=production,release",
"test": "nx test",
@ -104,7 +99,6 @@
"cypress": "^12.14.0",
"dotenv": "8.2.0",
"dotenv-expand": "^5.1.0",
"envsub": "^4.1.0",
"eslint": "^8.42.0",
"eslint-plugin-ban": "^1.6.0",
"eslint-plugin-import": "2.27.5",

View File

@ -49,10 +49,12 @@ export interface AcaBackend {
tearDown(): Promise<any>;
}
const { BASE_URL } = process.env;
const config = {
authType: 'BASIC',
hostBpm: process.env.APP_CONFIG_BPM_HOST,
hostEcm: process.env.APP_CONFIG_ECM_HOST,
hostBpm: BASE_URL,
hostEcm: BASE_URL,
provider: 'ECM',
contextRoot: 'alfresco'
};

View File

@ -19,15 +19,15 @@ const width = 1366;
const height = 768;
const SAVE_SCREENSHOT = process.env.SAVE_SCREENSHOT === 'true';
const APP_CONFIG_ECM_HOST = process.env.APP_CONFIG_ECM_HOST || 'http://localhost:8080';
const MAXINSTANCES = process.env.MAXINSTANCES || 1;
const E2E_LOG_LEVEL = process.env.E2E_LOG_LEVEL || 'ERROR';
const E2E_TS_CONFIG_FOR_ADF = 'tsconfig.e2e.adf.json';
const LOCAL_ADF_OPTION = '--with-local-adf';
const { BASE_URL } = process.env;
const appConfig = {
hostEcm: APP_CONFIG_ECM_HOST,
hostEcm: BASE_URL || 'http://localhost:8080',
providers: 'ECM',
authType: 'BASIC'
};