12
12
13
13
The following environment variables can be used to configure ` auth-rs ` :
14
14
15
- | Variable | Default | Required | Type | Description |
16
- | --------------------------| ---------------| ----------------------------------------------| -------------| ------------------------------------------------------------------------|
17
- | SERVER_ADDR | ` 0.0.0.0 ` | ` false ` | ` IPAddress ` | The server address |
18
- | SERVER_PORT | ` 8080 ` | ` false ` | ` u16 ` | The port that the server will use |
19
- | MAX_FETCH_LIMIT | ` 100 ` | ` false ` | ` i64 ` | The maximum amount of entity records that can be retrieved in one call |
20
- | DB_CONNECTION_STRING | N/A | ` true ` | ` String ` | The MongoDB connection string |
21
- | DB_DATABASE | N/A | ` true ` | ` String ` | The MongoDB Database that will be used by ` auth-rs ` |
22
- | DB_PERMISSION_COLLECTION | ` permissions ` | ` false ` | ` String ` | The collection that holds the ` Permission ` entities |
23
- | DB_ROLE_COLLECTION | ` roles ` | ` false ` | ` String ` | The collection that holds the ` Role ` entities |
24
- | DB_USER_COLLECTION | ` users ` | ` false ` | ` String ` | The collection that holds the ` User ` entities |
25
- | DB_AUDIT_COLLECTION | ` audits ` | ` false ` | ` String ` | The collection that holds the ` Audit ` entities |
26
- | DB_CREATE_INDEXES | ` true ` | ` false ` | ` bool ` | Automatically create collection indexes |
27
- | DB_AUDIT_ENABLED | ` false ` | ` false ` | ` bool ` | Enable or disable audit trails |
28
- | JWT_SECRET | N/A | ` true ` | ` String ` | The JWT secret |
29
- | JWT_EXPIRATION | ` 3600 ` | ` false ` | ` usize ` | The JWT expiration time in seconds |
30
- | RUST_LOG | N/A | ` false ` | ` String ` | The default log level |
31
- | RUST_BACKTRACE | N/A | ` false ` | ` String ` | Controls whether or not backtraces are displayed when a panic occurs |
32
- | GENERATE_DEFAULT_USER | ` true ` | ` false ` | ` bool ` | Sets whether a default administrator ` User ` should be generated |
33
- | DEFAULT_USER_USERNAME | N/A | ` true ` if ` GENERATE_DEFAULT_USER ` is enabled | ` String ` | The default ` User ` 's username |
34
- | DEFAULT_USER_EMAIL | N/A | ` false ` | ` String ` | The default ` User ` 's email address |
35
- | DEFAULT_USER_PASSWORD | N/A | ` true ` if ` GENERATE_DEFAULT_USER ` is enabled | ` String ` | The default ` User ` 's password |
36
- | DEFAULT_USER_ENABLED | N/A | ` true ` if ` GENERATE_DEFAULT_USER ` is enabled | ` bool ` | Sets whether the default user is enabled or not |
37
- | ENABLE_OPENAPI | ` true ` | ` false ` | ` bool ` | Enables or disables the OpenAPI endpoint |
15
+ | Variable | Default | Required | Type | Description |
16
+ | --------------------------| ---------------| ----------------------------------------------| -------------| -------------------------------------------------------------------------|
17
+ | SERVER_ADDR | ` 0.0.0.0 ` | ` false ` | ` IPAddress ` | The server address |
18
+ | SERVER_PORT | ` 8080 ` | ` false ` | ` u16 ` | The port that the server will use |
19
+ | MAX_FETCH_LIMIT | ` 100 ` | ` false ` | ` i64 ` | The maximum amount of entity records that can be retrieved in one call |
20
+ | DB_CONNECTION_STRING | N/A | ` true ` | ` String ` | The MongoDB connection string |
21
+ | DB_DATABASE | N/A | ` true ` | ` String ` | The MongoDB Database that will be used by ` auth-rs ` |
22
+ | DB_PERMISSION_COLLECTION | ` permissions ` | ` false ` | ` String ` | The collection that holds the ` Permission ` entities |
23
+ | DB_ROLE_COLLECTION | ` roles ` | ` false ` | ` String ` | The collection that holds the ` Role ` entities |
24
+ | DB_USER_COLLECTION | ` users ` | ` false ` | ` String ` | The collection that holds the ` User ` entities |
25
+ | DB_AUDIT_COLLECTION | ` audits ` | ` false ` | ` String ` | The collection that holds the ` Audit ` entities |
26
+ | DB_CREATE_INDEXES | ` true ` | ` false ` | ` bool ` | Automatically create collection indexes |
27
+ | DB_AUDIT_ENABLED | ` false ` | ` false ` | ` bool ` | Enable or disable audit trails |
28
+ | DB_AUDIT_TTL | ` 0 ` | ` false ` | ` u64 ` | Automatically remove ` Audit ` entities after a set amount of seconds |
29
+ | JWT_SECRET | N/A | ` true ` | ` String ` | The JWT secret |
30
+ | JWT_EXPIRATION | ` 3600 ` | ` false ` | ` usize ` | The JWT expiration time in seconds |
31
+ | RUST_LOG | N/A | ` false ` | ` String ` | The default log level |
32
+ | RUST_BACKTRACE | N/A | ` false ` | ` String ` | Controls whether or not backtraces are displayed when a panic occurs |
33
+ | GENERATE_DEFAULT_USER | ` true ` | ` false ` | ` bool ` | Sets whether a default administrator ` User ` should be generated |
34
+ | DEFAULT_USER_USERNAME | N/A | ` true ` if ` GENERATE_DEFAULT_USER ` is enabled | ` String ` | The default ` User ` 's username |
35
+ | DEFAULT_USER_EMAIL | N/A | ` false ` | ` String ` | The default ` User ` 's email address |
36
+ | DEFAULT_USER_PASSWORD | N/A | ` true ` if ` GENERATE_DEFAULT_USER ` is enabled | ` String ` | The default ` User ` 's password |
37
+ | DEFAULT_USER_ENABLED | N/A | ` true ` if ` GENERATE_DEFAULT_USER ` is enabled | ` bool ` | Sets whether the default user is enabled or not |
38
+ | ENABLE_OPENAPI | ` true ` | ` false ` | ` bool ` | Enables or disables the OpenAPI endpoint |
38
39
39
40
> * Note* : The audit trail feature is disabled by default and will have a noticeable performance impact when enabled.
41
+ > Audit trails can be set to expire automatically after a set amount of seconds by changing the ` DB_AUDIT_TTL ` environment variable
42
+ > to the desired amount of seconds (greater than zero), if the ` DB_CREATE_INDEXES ` variable is also enabled.
40
43
41
44
## Changing the default configuration
42
45
@@ -54,7 +57,7 @@ You can add environment variables when running the container using the `-e` flag
54
57
An example of running the container using Docker:
55
58
56
59
``` bash
57
- docker run -d -p 8080:8080 -e DB_CONNECTION_STRING=mongodb://localhost:27017 -e DB_DATABASE=auth-rs -e HASH_SALT=mysalt -e JWT_SECRET=mysecret -e DEFAULT_USER_USERNAME=admin -e DEFAULT_USER_PASSWORD=secret -e DEFAULT_USER_ENABLED=true opserva/auth-rs
60
+ docker run -d -p 8080:8080 -e DB_CONNECTION_STRING=mongodb://localhost:27017 -e DB_DATABASE=auth-rs -e -e JWT_SECRET=mysecret -e DEFAULT_USER_USERNAME=admin -e DEFAULT_USER_PASSWORD=secret -e DEFAULT_USER_ENABLED=true opserva/auth-rs
58
61
```
59
62
60
63
Alternatively, you can provide an ` .env ` file to the container using the ` --env-file ` flag:
0 commit comments