From 51447cbfd6e324797cfb2d640d89beaf599e0db7 Mon Sep 17 00:00:00 2001 From: Tommaso Bailetti Date: Fri, 12 Jan 2024 18:05:46 +0100 Subject: [PATCH] docs: added setup and runtime config sections --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/README.md b/README.md index e9e2465..cf2f7be 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,26 @@ inside a container, to keep at minimum dependency discrepancies between develope The script `dev.sh` is provided to ease the development. +### Setup + +#### Server side + +Before starting, you'll need to edit the `api-moduled.service` in your nethserver installation and change +from `Environment=GIN_MODE=release` to `Environment=GIN_MODE=debug`. This will take care of every CORS policy issues. + +The file can be found under `/etc/systemd/user/api-moduled.service`. If you edited the file after installing any domain +related module, remember to access the module you want to develop on and run `systemctl --user daemon-reload` and +then `systemctl --user restart api-moduled`. + +#### Client side + +Client side, copy the [`.env.development.example`](.env.development.example) and rename it `.env.development`. + +In there you'll find the `VITE_ENDPOINT` variable, it needs to be filled with the domain URL +(I.E. `https:///users-admin/`). + +You can then leave the file there or edit it if needed, it won't be included in the final build. + ### Booting up the UI To boot the UI, simply run @@ -42,6 +62,30 @@ The command `build` is a special one, rebuilds the development container even if To build the UI, simply run `./build.sh`, this will build the UI in isolated environment, the result will be put in the `dist` folder. +## Runtime Configuration + +You can configure the following sections of the application by placing a `config.json` file in the same directory as +the `index.html` once the build is completed: + +- `domain`: Domain to be shown in the login page and on the top right of the interface; +- `services`: An array of strings that lists the services that this domain is attached to. They will be displayed (after + they're passed through the translator) as bullet point list in the `Account Page` under `Change Password`. + +Example: + +```json +{ + "domain": "samba.com", + "services": [ + "nethvoice", + "nethservice" + ] +} +``` + +Note: if you're using the development environment and you've set the .env.development file, the file must be put inside +the `public` folder of the module that you're using. (I.E. `/home/samba1/.config/api-moduled/public/config.json`) + ## License All the repo is licensed under [GPL 3.0 or later](LICENSE) license. \ No newline at end of file