Skip to content

Commit

Permalink
feat: override config locale with environment value to automate build…
Browse files Browse the repository at this point in the history
… process (#11)

* feat: override config locale with environment value to automate build process

* 1.5.0
  • Loading branch information
sapachev authored Feb 7, 2023
1 parent 835e0bd commit 0688cc0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ runContainer
.resolve(FileSystemHelper)
.readConfig(pr.get("config"))
.then((config) => {
// Override locale config parameter with environment variable
if (process.env.LOCALE) {
config.locale = process.env.LOCALE;
runContainer.get<ILogger>(DI_TOKENS.LOGGER).print(Messages.warn(MessagesEnum.ENV_LOCALE, { locale: config.locale }));
}

runContainer.bind<Config>(DI_TOKENS.CONFIG).toConstantValue(config);

// Registry update with new paths, which depends on current config
Expand Down
1 change: 1 addition & 0 deletions messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export enum MessagesEnum {
SKIP_WRITE = "write to {{ &path }}",

// Warnings
ENV_LOCALE = "Config locale value was overrided with environment value '{{ locale }}'",
NO_ASSETS_TO_COPY = "No assets in current theme directory",
TAILWIND_DISABLED = "Tailwind CSS was disabled in config",
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "error-pages",
"version": "1.4.0",
"version": "1.5.0",
"description": "Lightweight tool to create static HTTP Error Pages in minimalistic adaptive and accessible design with customization and localization support",
"main": "index.ts",
"scripts": {
Expand Down

0 comments on commit 0688cc0

Please sign in to comment.