Fixes post review by Rugvip:

1. Ensuring that reloadIntervals, if present, is a valid positive number
2. Remote config error message fix
3. Removed remote config from example backend
4. Lessened the writing.md
5. Multiple changesets

Signed-off-by: Praveen Ranjan Keshri <prkeshri@gmail.com>
This commit is contained in:
Praveen Ranjan Keshri
2021-12-08 00:21:53 +05:30
parent d5d69f1169
commit 1e7070443d
5 changed files with 11 additions and 26 deletions
+3 -18
View File
@@ -75,25 +75,10 @@ files. Paths are relative to the working directory of the executed process, for
example `package/backend`. This means that to select a config file in the repo
root when running the backend, you would use `--config ../../my-config.yaml`,
and for config file on a config server you would use
`--config https://some.domain.io/app-config.yaml`<br/>
`--config https://some.domain.io/app-config.yaml`
**\*Note**: In order to use remote urls, ensure that the option 'remote' is
passed in `loadBackendConfig(...)` call (See below) inside
`packages/backend/src/index.ts`, with the option of
reloadIntervalSeconds(required) as given below. This will allow the usage of
remote configs and also, will ensure that this config is checked for any changes
every 12 hours. (This can be any desired value in seconds, here 60 _ 60 _ 12 =
12 hours!):
```ts
const config = await loadBackendConfig({
argv: process.argv,
logger,
remote: {
reloadIntervalSeconds: 60 * 60 * 12, // Check remote config changes every 12 hours. Change to your desired interval in seconds
},
});
```
**Note**: In case URLs are passed, it is also needed to set the remote option in
the loadBackendConfig call.
If no `config` flags are specified, the default behavior is to load
`app-config.yaml` and, if it exists, `app-config.local.yaml` from the repo root.