From 2757af6bf0f9789284aaa2c8d295db3f6b320bd6 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Thu, 12 Dec 2019 11:04:20 +0100 Subject: [PATCH] adding config only mode --- README.md | 5 +++-- docker/arm32v7/debian/stretch/Dockerfile | 2 +- package.json | 2 +- src/common/config/private/ConfigClass.ts | 5 +++++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 24d711c9..35b46674 100644 --- a/README.md +++ b/README.md @@ -94,8 +94,9 @@ You can set up the app the following ways: * Using the UI * Manually editing the `config.json` * Through switches - * Like: `node backend/index.js --Server-port=3000 --Client-authenticationRequired=false` + * Like: `node start -- --Server-port=3000 --Client-authenticationRequired=false` * You can check the generated `config.json` for the config hierarchy + * Note: you can run the app to generate the config file only, by running `npm start -- --config-only` * Through environmental variable * like set env. variable `Server-port` to `3000` @@ -122,7 +123,7 @@ apt-get install build-essential libkrb5-dev gcc g++ ```bash npm run add-translation -- --fr ``` - it creates a new `messages.fr.xls` file at `frontend/translate` folder, + it creates a new `messages.fr.xls` file at `src/frontend/translate` folder, it will already contain dummy translation with google translate. 3. 'fix' the dummy translation 4. test if it works: diff --git a/docker/arm32v7/debian/stretch/Dockerfile b/docker/arm32v7/debian/stretch/Dockerfile index fa106718..f499f9f4 100644 --- a/docker/arm32v7/debian/stretch/Dockerfile +++ b/docker/arm32v7/debian/stretch/Dockerfile @@ -1,6 +1,6 @@ FROM arm32v7/node:10-stretch LABEL maintainer="Patrik J. Braun" - +# build tutorial: https://collabnix.com/building-arm-based-docker-images-on-docker-desktop-made-possible-using-buildx/ RUN git clone https://github.com/bpatrik/pigallery2.git && \ cd /pigallery2 && \ diff --git a/package.json b/package.json index 2c100982..43962953 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "build-backend": "tsc", "pretest": "tsc", "test": "ng test && mocha --recursive test/backend/unit && mocha --recursive test/backend/integration && mocha --recursive test/common/unit ", - "start": "node ./backend/index", + "start": "node ./src/backend/index", "run-dev": "ng build --aot --watch --output-path=./dist --i18n-locale en --i18n-file src/frontend/translate/messages.en.xlf --i18n-missing-translation warning", "build-stats": "ng build --aot --prod --stats-json --output-path=./dist --i18n-locale en --i18n-file src/frontend/translate/messages.en.xlf --i18n-missing-translation warning", "merge-new-translation": "gulp merge-new-translation", diff --git a/src/common/config/private/ConfigClass.ts b/src/common/config/private/ConfigClass.ts index e9fe6900..84cf5c58 100644 --- a/src/common/config/private/ConfigClass.ts +++ b/src/common/config/private/ConfigClass.ts @@ -32,6 +32,11 @@ export class ConfigClass extends PrivateConfigDefaultsClass implements IPrivateC ['MYSQL_DATABASE', 'Server-Database-mysql-database']]); this.removeComment(); + if (process.argv.indexOf('--config-only')) { + console.log('started with \'--config-only\' flag. Saving config and exiting.'); + process.exit(); + } + if (Utils.enumToArray(UserRoles).map(r => r.key).indexOf(this.Client.unAuthenticatedUserRole) === -1) { throw new Error('Unknown user role for Client.unAuthenticatedUserRole, found: ' + this.Client.unAuthenticatedUserRole); }