# Configuration

### Imports

{% tabs %}
{% tab title="Service" %}

<pre class="language-typescript"><code class="lang-typescript"><strong>import { ConfigurationService } from 'niro-health';
</strong></code></pre>

{% endtab %}

{% tab title="Module" %}

```typescript
import { ConfigurationModule } from 'niro-health';
```

{% endtab %}

{% tab title="Interface" %}

```typescript
import type { IConfigurationService } from 'niro-health';
```

{% endtab %}
{% endtabs %}

### Method of Use

To use this module, you need to inject it into the desired service.

{% code overflow="wrap" %}

```typescript
import { Module } from '@nestjs/common';
import {
  ConfigurationService,
  StringExService,
  ValidatorRegexpService,
} from 'niro-health';
import { AppController } from './app.controller';
import { AppService } from './app.service';

@Module({
  controllers: [AppController],
  providers: [
    AppService,
    {
      provide: 'IConfigurationService',
      useClass: ConfigurationService,
    },
    {
      provide: 'IValidatorRegexpService',
      useClass: ValidatorRegexpService,
    },
    {
      provide: 'IStringExService',
      useClass: StringExService,
    },
  ],
})
export class AppModule {}
```

{% endcode %}

Injecting the module into our service.

```typescript
import { Inject, Injectable } from '@nestjs/common';
import type { IConfigurationService } from 'niro-health';

@Injectable()
export class AppService {
  constructor(
    @Inject('IConfigurationService')
    private readonly configurationService: IConfigurationService,
  ) {}

  async isDev() {
    return this.configurationService.isDev;
  }
}
```

### With dependencies

You will need to inject the following interfaces.

| Interface                 | Service                       |
| ------------------------- | ----------------------------- |
| `IValidatorRegexpService` | Link to Service documentation |
| `IStringExService`        | Link to Service documentation |

### Properties

<table><thead><tr><th width="339.3333333333333">Property</th><th width="115" align="center">Scope</th><th>Description</th></tr></thead><tbody><tr><td><code>_NODE_ENV</code></td><td align="center"><code>private</code></td><td><code>The node environment to use.</code></td></tr><tr><td><code>_VERSION</code></td><td align="center"><code>private</code></td><td><code>The application version.</code></td></tr><tr><td><code>_API_URI</code></td><td align="center"><code>private</code></td><td><code>The application back-end API URI.</code></td></tr><tr><td><code>_WEBAPP_URI</code></td><td align="center"><code>private</code></td><td><code>The application front-end API URI.</code></td></tr><tr><td><code>_PORT</code></td><td align="center"><code>private</code></td><td><code>The port to use.</code></td></tr><tr><td><code>_DATABASE_URL</code></td><td align="center"><code>private</code></td><td><code>The database URL.</code></td></tr><tr><td><code>_DB_PORT</code></td><td align="center"><code>private</code></td><td><code>The database port.</code></td></tr><tr><td><code>_DB_USERNAME</code></td><td align="center"><code>private</code></td><td><code>The database username.</code></td></tr><tr><td><code>_DB_PASSWORD</code></td><td align="center"><code>private</code></td><td><code>The database password.</code></td></tr><tr><td><code>_DB_DATABASE_NAME</code></td><td align="center"><code>private</code></td><td><code>The database name.</code></td></tr><tr><td><code>_MONGODB_USERNAME</code></td><td align="center"><code>private</code></td><td><code>The mongodb username.</code></td></tr><tr><td><code>_MONGODB_PASSWORD</code></td><td align="center"><code>private</code></td><td><code>The mongodb password.</code></td></tr><tr><td><code>_MONGODB_HOST</code></td><td align="center"><code>private</code></td><td><code>The mongodb host.</code></td></tr><tr><td><code>_MONGODB_PORT</code></td><td align="center"><code>private</code></td><td><code>The mongodb port.</code></td></tr><tr><td><code>_MONGODB_NAME</code></td><td align="center"><code>private</code></td><td><code>The mongodb name.</code></td></tr><tr><td><code>_MONGODB_GRIDFS_NAME</code></td><td align="center"><code>private</code></td><td><code>The mongodb gridfs name.</code></td></tr><tr><td><code>_MONGODB_CONNECTION_SSL</code></td><td align="center"><code>private</code></td><td><code>The mongodb connection ssl.</code></td></tr><tr><td><code>_MONGODB_PROJECT_NAME</code></td><td align="center"><code>private</code></td><td><code>The mongodb project name.</code></td></tr><tr><td><code>_REDIS_HOST</code></td><td align="center"><code>private</code></td><td><code>The redis host.</code></td></tr><tr><td><code>_REDIS_PORT</code></td><td align="center"><code>private</code></td><td><code>The redis port.</code></td></tr><tr><td><code>_REDIS_PASSWORD</code></td><td align="center"><code>private</code></td><td><code>The redis password.</code></td></tr><tr><td><code>_BULL_BOARD_USERNAME</code></td><td align="center"><code>private</code></td><td><code>The bull board username.</code></td></tr><tr><td><code>_BULL_BOARD_PASSWORD</code></td><td align="center"><code>private</code></td><td><code>The bull board password.</code></td></tr><tr><td><code>_CRON_TIMEZONE</code></td><td align="center"><code>private</code></td><td><code>The cron timezone.</code></td></tr><tr><td><code>_CRYPTO_PASSWORD</code></td><td align="center"><code>private</code></td><td><code>The crypto password.</code></td></tr><tr><td><code>_MASTER_KEY</code></td><td align="center"><code>private</code></td><td><code>The master key used to authenticate the routes.</code></td></tr><tr><td><code>_JWT_SECRET</code></td><td align="center"><code>private</code></td><td><code>The secret for Json Web Token.</code></td></tr><tr><td><code>_COOKIE_SECRET</code></td><td align="center"><code>private</code></td><td><code>The secret for the cookies.</code></td></tr><tr><td><code>_SESSION_SECRET</code></td><td align="center"><code>private</code></td><td><code>The secret for the sessions.</code></td></tr><tr><td><code>_AXIOS_URI</code></td><td align="center"><code>private</code></td><td><code>The URI for the axios requests.</code></td></tr><tr><td><code>_AXIOS_AUTHORIZATION</code></td><td align="center"><code>private</code></td><td><code>The authorization for the axios requests.</code></td></tr><tr><td><code>_AWS_ACCESS_KEY_ID</code></td><td align="center"><code>private</code></td><td><code>The AWS access key id.</code></td></tr><tr><td><code>_AWS_SECRET_ACCESS_KEY</code></td><td align="center"><code>private</code></td><td><code>The AWS secret access key.</code></td></tr><tr><td><code>_SMTP_HOST</code></td><td align="center"><code>private</code></td><td><code>The SMTP host.</code></td></tr><tr><td><code>_SMTP_PORT</code></td><td align="center"><code>private</code></td><td><code>The SMTP port.</code></td></tr><tr><td><code>_SMTP_SECURE</code></td><td align="center"><code>private</code></td><td><code>The SMTP secure.</code></td></tr><tr><td><code>_SMTP_USERNAME</code></td><td align="center"><code>private</code></td><td><code>The SMTP username.</code></td></tr><tr><td><code>_SMTP_PASSWORD</code></td><td align="center"><code>private</code></td><td><code>The SMTP password.</code></td></tr><tr><td><mark style="color:blue;"><strong><code>@ENVS</code></strong></mark></td><td align="center"><code>static</code></td><td><code>The environment variables.</code></td></tr><tr><td><mark style="color:blue;"><strong><code>@VARIABLES</code></strong></mark></td><td align="center"><code>static</code></td><td><code>The variables.</code></td></tr></tbody></table>

### Methods

<table><thead><tr><th width="336.3333333333333">Method</th><th width="117" align="center">Scope</th><th>Description</th></tr></thead><tbody><tr><td><code>_check</code></td><td align="center"><code>private</code></td><td><code>Check the environment variables.</code></td></tr><tr><td><code>_load</code></td><td align="center"><code>private</code></td><td><code>Load environment variables</code></td></tr><tr><td><code>_transformBoolean</code></td><td align="center"><code>private</code></td><td><code>Transform string to boolean.</code></td></tr><tr><td><code>_compress</code></td><td align="center"><code>private</code></td><td><code>Compress the value to string.</code></td></tr><tr><td><code>_decompress</code></td><td align="center"><code>private</code></td><td><code>Decompress the string to original value.</code></td></tr><tr><td><code>get</code></td><td align="center"><code>public</code></td><td><code>Get the value from the environment.</code></td></tr><tr><td><code>register</code></td><td align="center"><code>public</code></td><td><code>Set the value to the environment.</code></td></tr><tr><td><code>unregister</code></td><td align="center"><code>public</code></td><td><code>Delete the value from the environment.</code></td></tr><tr><td><code>getVariable</code></td><td align="center"><code>public</code></td><td><code>Get the value from the variable.</code></td></tr><tr><td><code>setVariable</code></td><td align="center"><code>public</code></td><td><code>Set the value to the variable.</code></td></tr><tr><td><code>delVariable</code></td><td align="center"><code>public</code></td><td><code>Delete the value from the variable.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>NODE_ENV</code></td><td align="center"><code>public</code></td><td><code>Returns the node environment.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>VERSION</code></td><td align="center"><code>public</code></td><td><code>Returns the version of the application.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>API_URI</code></td><td align="center"><code>public</code></td><td><code>Returns the uri of the back-end.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>WEBAPP_URI</code></td><td align="center"><code>public</code></td><td><code>Returns the uri of the front-end.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>PORT</code></td><td align="center"><code>public</code></td><td><code>Returns the port of the application.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>DATABASE_URL</code></td><td align="center"><code>public</code></td><td><code>Returns the url of the database.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>DB_PORT</code></td><td align="center"><code>public</code></td><td><code>Returns the port of the database.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>DB_USERNAME</code></td><td align="center"><code>public</code></td><td><code>Returns the username of the database.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>DB_PASSWORD</code></td><td align="center"><code>public</code></td><td><code>Returns the password of the database.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>DB_DATABASE_NAME</code></td><td align="center"><code>public</code></td><td><code>Returns the name of the database.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>MONGODB_USERNAME</code></td><td align="center"><code>public</code></td><td><code>Returns the username of the mongodb.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>MONGODB_PASSWORD</code></td><td align="center"><code>public</code></td><td><code>Returns the password of the mongodb.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>MONGODB_HOST</code></td><td align="center"><code>public</code></td><td><code>Returns the host of the mongodb.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>MONGODB_PORT</code></td><td align="center"><code>public</code></td><td><code>Returns the port of the mongodb.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>MONGODB_NAME</code></td><td align="center"><code>public</code></td><td><code>Returns the name of the mongodb.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>MONGODB_GRIDFS_NAME</code></td><td align="center"><code>public</code></td><td><code>Returns the name of the gridfs in mongodb.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>MONGODB_CONNECTION_SSL</code></td><td align="center"><code>public</code></td><td><code>Returns the ssl connection of the mongodb.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>MONGODB_PROJECT_NAME</code></td><td align="center"><code>public</code></td><td><code>Returns the project name of the mongodb.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>REDIS_HOST</code></td><td align="center"><code>public</code></td><td><code>Returns the host of the redis.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>REDIS_PORT</code></td><td align="center"><code>public</code></td><td><code>Returns the port of the redis.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>REDIS_PASSWORD</code></td><td align="center"><code>public</code></td><td><code>Returns the password of the redis.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>BULL_BOARD_USERNAME</code></td><td align="center"><code>public</code></td><td><code>Returns the username of the bull board.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>BULL_BOARD_PASSWORD</code></td><td align="center"><code>public</code></td><td><code>Returns the password of the bull board.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>CRON_TIMEZONE</code></td><td align="center"><code>public</code></td><td><code>Returns the timezone of the cron.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>CRYPTO_PASSWORD</code></td><td align="center"><code>public</code></td><td><code>Returns the password of the crypto.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>MASTER_KEY</code></td><td align="center">public</td><td><code>Returns the master keys.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>JWT_SECRET</code></td><td align="center"><code>public</code></td><td><code>Returns the secret of the Json Web Token.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>COOKIE_SECRET</code></td><td align="center"><code>public</code></td><td><code>Returns the secret of the cookies.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>SESSION_SECRET</code></td><td align="center"><code>public</code></td><td><code>Returns the secret of the sessions.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>AXIOS_URI</code></td><td align="center"><code>public</code></td><td><code>Returns the uri of the axios requests.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>AXIOS_AUTHORIZATION</code></td><td align="center"><code>public</code></td><td><code>Returns the authorization of the axios requests.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>AWS_ACCESS_KEY_ID</code></td><td align="center"><code>public</code></td><td><code>Returns the access key id of the aws.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>AWS_SECRET_ACCESS_KEY</code></td><td align="center"><code>public</code></td><td><code>Returns the secret of the access key in aws.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>SMTP_HOST</code></td><td align="center"><code>public</code></td><td><code>Returns the host of the smtp.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>SMTP_PORT</code></td><td align="center"><code>public</code></td><td><code>Returns the port of the smtp.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>SMTP_SECURE</code></td><td align="center"><code>public</code></td><td><code>Returns the secure of the smtp.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>SMTP_USERNAME</code></td><td align="center"><code>public</code></td><td><code>Returns the username of the smtp.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>SMTP_PASSWORD</code></td><td align="center"><code>public</code></td><td><code>Returns the password of the smtp.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>isDev</code></td><td align="center"><code>public</code></td><td><code>Check if the environment is development.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>isProd</code></td><td align="center"><code>public</code></td><td><code>Check if the environment is production.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>isTest</code></td><td align="center"><code>public</code></td><td><code>Check if the environment is test.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>mongoDB</code></td><td align="center"><code>public</code></td><td><code>Returns the mongoDB configuration.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>redis</code></td><td align="center"><code>public</code></td><td><code>Returns the redis configuration.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>bullBoard</code></td><td align="center"><code>public</code></td><td><code>Returns the bull board configuration.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>secrets</code></td><td align="center"><code>public</code></td><td><code>Returns the secrets of the application (crypto, master key, jwt, cookie, session).</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>axios</code></td><td align="center"><code>public</code></td><td><code>Returns the axios configuration.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>aws</code></td><td align="center"><code>public</code></td><td><code>Returns the aws configuration.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>smtp</code></td><td align="center"><code>public</code></td><td><code>Returns the smtp configuration.</code></td></tr></tbody></table>
