Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ Provides the PROCESS_ENV service</a> : <code>Object</code></dt>
<dd><p>Initialize the ENV service using process env plus dotenv files
loaded in <code>.env.node.${ENV.NODE_ENV}</code> and <code>.env.app.${APP_ENV}</code>.</p>
</dd>
<dt><a href="#readSecretFile">readSecretFile()</a></dt>
<dd><p>Extracts a secret from a file. Useful if you prefer
extracting your secrets yourself considering the
ENV service as unsafe.</p>
</dd>
<dt><a href="#initProcess">initProcess(services)</a> ⇒ <code>Promise.&lt;Object&gt;</code></dt>
<dd><p>Instantiate the process service</p>
</dd>
Expand Down Expand Up @@ -80,11 +85,20 @@ Initialize the ENV service using process env plus dotenv files
| --- | --- | --- | --- |
| services | <code>Object</code> | | The services `ENV` depends on |
| [services.BASE_ENV] | <code>Object</code> | | Base env vars that will be added to the environment |
| [services.ENV_SECRETS_FILES] | <code>Object</code> | | Options allowing to detect env vars to load in secret files |
| services.APP_ENV | <code>Object</code> | | The injected `APP_ENV` value |
| services.PROCESS_ENV | <code>Object</code> | | The injected `process.env` value |
| services.PROJECT_DIR | <code>Object</code> | | The NodeJS project directory |
| [services.log] | <code>Object</code> | <code>noop</code> | An optional logging service |

<a name="readSecretFile"></a>

## readSecretFile()
Extracts a secret from a file. Useful if you prefer
extracting your secrets yourself considering the
ENV service as unsafe.

**Kind**: global function
<a name="initProcess"></a>

## initProcess(services) ⇒ <code>Promise.&lt;Object&gt;</code>
Expand Down
17 changes: 9 additions & 8 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[//]: # ( )
[//]: # (This file is automatically generated by the `jsarch`)
[//]: # (module. Do not change it elsewhere, changes would)
[//]: # (be overriden.)
[//]: # (be overridden.)
[//]: # ( )
# Architecture Notes

Expand Down Expand Up @@ -104,9 +104,10 @@ The `ENV` service adds a layer of configuration over just using
Per default, we take the process environment as is
but since it could lead to leaks when building
projects statically so one can isolate the process
env by using the `ISOLATED_ENV` environment variable.
env by setting the `ISOLATED_ENV` environment variable
to anything different of 0 or FALSE (case insensitive).

[See in context](./src/services/ENV.ts#L106-L111)
[See in context](./src/services/ENV.ts#L127-L133)



Expand All @@ -116,7 +117,7 @@ You may want to set some env vars depending on the
`NODE_ENV`. We use `dotenv` to provide your such
ability.

[See in context](./src/services/ENV.ts#L139-L144)
[See in context](./src/services/ENV.ts#L165-L170)



Expand All @@ -125,7 +126,7 @@ You may want to set some env vars depending on the
You may need to keep some secrets out of your Git
history fo each deployment targets too.

[See in context](./src/services/ENV.ts#L147-L150)
[See in context](./src/services/ENV.ts#L173-L176)



Expand All @@ -138,7 +139,7 @@ The final environment is composed from the different sources
- the process ENV (so that one can override values by
adding environment variables).

[See in context](./src/services/ENV.ts#L153-L160)
[See in context](./src/services/ENV.ts#L179-L186)



Expand All @@ -159,7 +160,7 @@ The `process` service takes care of the process status.
It returns nothing and should be injected only for its
side effects.

[See in context](./src/services/process.ts#L35-L40)
[See in context](./src/services/process.ts#L15-L20)



Expand Down Expand Up @@ -232,5 +233,5 @@ The `timeMock` service allows developers to mock the time
of the application by injecting it instead of the `time`
service provided by the `common-services` module.

[See in context](./src/services/timeMock.ts#L23-L28)
[See in context](./src/services/timeMock.ts#L4-L9)

16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Out of the box, standard compliant, application environment:
- managing application environment in a clean and separate `APP_ENV` environment
variable,
- leverage `dotenv` to read environment variables,
- use secret files to fill environment variables (useful for
[Docker Compose secrets](https://docs.docker.com/compose/how-tos/use-secrets/)),
- manage separate and type checked applications configurations for each
deployment environments and allows loading it automatically (in the
`./configs/${APP_ENV}/index` file).
Expand Down Expand Up @@ -63,6 +65,11 @@ Provides the PROCESS_ENV service</a> : <code>Object</code></dt>
<dd><p>Initialize the ENV service using process env plus dotenv files
loaded in <code>.env.node.${ENV.NODE_ENV}</code> and <code>.env.app.${APP_ENV}</code>.</p>
</dd>
<dt><a href="#readSecretFile">readSecretFile()</a></dt>
<dd><p>Extracts a secret from a file. Useful if you prefer
extracting your secrets yourself considering the
ENV service as unsafe.</p>
</dd>
<dt><a href="#initProcess">initProcess(services)</a> ⇒ <code>Promise.&lt;Object&gt;</code></dt>
<dd><p>Instantiate the process service</p>
</dd>
Expand Down Expand Up @@ -122,11 +129,20 @@ Initialize the ENV service using process env plus dotenv files
| --- | --- | --- | --- |
| services | <code>Object</code> | | The services `ENV` depends on |
| [services.BASE_ENV] | <code>Object</code> | | Base env vars that will be added to the environment |
| [services.ENV_SECRETS_FILES] | <code>Object</code> | | Options allowing to detect env vars to load in secret files |
| services.APP_ENV | <code>Object</code> | | The injected `APP_ENV` value |
| services.PROCESS_ENV | <code>Object</code> | | The injected `process.env` value |
| services.PROJECT_DIR | <code>Object</code> | | The NodeJS project directory |
| [services.log] | <code>Object</code> | <code>noop</code> | An optional logging service |

<a name="readSecretFile"></a>

## readSecretFile()
Extracts a secret from a file. Useful if you prefer
extracting your secrets yourself considering the
ENV service as unsafe.

**Kind**: global function
<a name="initProcess"></a>

## initProcess(services) ⇒ <code>Promise.&lt;Object&gt;</code>
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ts-check
// @ts-check

export default {
extends: ['@commitlint/config-conventional'],
Expand Down
Loading
Loading