-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update for better initial setting (#225)
* fix: update for better initial setting - update outdated env vars - update README - fix validation on env vars - update docker-compose file * fix: e2e test * fix: database name * fix: web required env vars
- Loading branch information
Showing
16 changed files
with
193 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,33 @@ | ||
JWT_SECRET= # required | ||
# Required enviroment variables | ||
JWT_SECRET=DEV | ||
|
||
MYSQL_PRIMARY_URL= # required, default: mysql://userfeedback:userfeedback@localhost:13306/userfeedback | ||
MYSQL_SECONDARY_URLS= # required, default: ["mysql://userfeedback:userfeedback@localhost:13306/userfeedback"] | ||
MYSQL_PRIMARY_URL=mysql://userfeedback:userfeedback@localhost:13306/userfeedback # required | ||
|
||
SMTP_USE= # default: false | ||
SMTP_HOST= # required if SMTP_USE=true | ||
SMTP_PORT= # required if SMTP_USE=true | ||
SMTP_USERNAME= # required if SMTP_USE=true | ||
SMTP_PASSWORD= # required if SMTP_USE=true | ||
SMTP_SENDER= # required if SMTP_USE=true | ||
SMTP_BASE_URL= # required if SMTP_USE=true | ||
BASE_URL=http://localhost:3000 # default: http://localhost:3000 | ||
|
||
OS_USE= # default: false | ||
OS_NODE= # default: http://localhost:9200 | ||
OS_USERNAME= # default: "" | ||
OS_PASSWORD= # default: "" | ||
ACCESS_TOKEN_EXPIRED_TIME=10m # default: 10m | ||
REFESH_TOKEN_EXPIRED_TIME=1h # default: 1h | ||
|
||
APP_PORT= # default: 4000 | ||
APP_ADDRESS= # default: 0.0.0.0 | ||
# Optional enviroment variables | ||
|
||
AUTO_MIGRATION= # default: false | ||
# APP_PORT=4000 # default: 4000 | ||
# APP_ADDRESS=0.0.0.0 # default: 0.0.0.0 | ||
|
||
MASTER_API_KEY= # default: none | ||
BASE_URL= # default: http://localhost:3000 | ||
# MYSQL_SECONDARY_URLS= ["mysql://userfeedback:userfeedback@localhost:13306/userfeedback"] # optional | ||
|
||
ACCESS_TOKEN_EXPIRED_TIME= # default: 10m | ||
REFESH_TOKEN_EXPIRED_TIME= # default: 1h | ||
# SMTP_USE=false # default: false | ||
# SMTP_HOST= # required if SMTP_USE=true | ||
# SMTP_PORT= # required if SMTP_USE=true | ||
# SMTP_USERNAME= # required if SMTP_USE=true | ||
# SMTP_PASSWORD= # required if SMTP_USE=true | ||
# SMTP_SENDER= # required if SMTP_USE=true | ||
# SMTP_BASE_URL= # required if SMTP_USE=true | ||
|
||
# OPENSEARCH_USE=false # default: false | ||
# OPENSEARCH_NODE= # required if OPENSEARCH_USE=true | ||
# OPENSEARCH_USERNAME= # required if OPENSEARCH_USE=true | ||
# OPENSEARCH_PASSWORD= # required if OPENSEARCH_USE=true | ||
|
||
# AUTO_MIGRATION=true # default: true | ||
|
||
# MASTER_API_KEY= # default: none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,29 +68,40 @@ npm run migration:run | |
|
||
## Environment Variables | ||
|
||
| Environment | Description | Default Value | | ||
| ------------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------ | | ||
| JWT_SECRET | JWT secret | # required | | ||
| MYSQL_PRIMARY_URL | mysql url | mysql://userfeedback:userfeedback@localhost:13306/userfeedback | | ||
| MYSQL_SECONDARY_URLS | mysql sub urls (must be json array format) | ["mysql://userfeedback:userfeedback@localhost:13306/userfeedback"] | | ||
| SMTP_USE | flag for using smtp server (for email verification on creating user) | false | | ||
| SMTP_HOST | smtp server host | localhost | | ||
| SMTP_PORT | smtp server port | 25 | | ||
| SMTP_USERNAME | smtp auth username | | | ||
| SMTP_PASSWORD | smtp auth password | | | ||
| SMTP_SENDER | mail sender email | [email protected] | | ||
| SMTP_BASE_URL | default UserFeedback URL for mail to be redirected | http://localhost:3000 | | ||
| APP_PORT | the post that the server is running on | 4000 | | ||
| APP_ADDRESS | the address that the server is running on | 0.0.0.0 | | ||
| OS_USE | flag for using opensearch (for better performance on searching feedback) | false | | ||
| OS_NODE | opensearch node url | http://localhost:9200 | | ||
| OS_USERNAME | opensearch username if exists | | | ||
| OS_PASSWORD | opensearch password if exists | | | ||
| AUTO_MIGRATION | set 'true' if you want to make the database migration automatically | | | ||
| MASTER_API_KEY | set a key if you want to make a master key for creating feedback | | | ||
| NODE_OPTIONS | set some options if you want to add for node execution (e.g. max_old_space_size) | | | ||
| ACCESS_TOKEN_EXPIRED_TIME | set expired time of access token | 10m | | ||
| REFESH_TOKEN_EXPIRED_TIME | set expired time of refresh token | 1h | | ||
The following is a list of environment variables used by the application, along with their descriptions and default values. | ||
|
||
### Required Environment Variables | ||
|
||
| Environment | Description | Default Value | | ||
| --------------------------- | -------------------------------------------- | -------------------------------------------------------- | | ||
| `JWT_SECRET` | Secret key for signing JSON Web Tokens (JWT) | _required_ | | ||
| `MYSQL_PRIMARY_URL` | Primary MySQL connection URL | `mysql://userfeedback:userfeedback@localhost:13306/test` | | ||
| `BASE_URL` | Base URL of the application | `http://localhost:3000` | | ||
| `ACCESS_TOKEN_EXPIRED_TIME` | Duration until the access token expires | `10m` | | ||
| `REFESH_TOKEN_EXPIRED_TIME` | Duration until the refresh token expires | `1h` | | ||
|
||
### Optional Environment Variables | ||
|
||
| Environment | Description | Default Value | | ||
| ---------------------- | -------------------------------------------------------------- | ----------------------------------- | | ||
| `APP_PORT` | The port that the server runs on | `4000` | | ||
| `APP_ADDRESS` | The address that the server binds to | `0.0.0.0` | | ||
| `MYSQL_SECONDARY_URLS` | Secondary MySQL connection URLs (must be in JSON array format) | _optional_ | | ||
| `SMTP_USE` | Flag to enable SMTP server usage (for email verification) | `false` | | ||
| `SMTP_HOST` | SMTP server host | _required if `SMTP_USE=true`_ | | ||
| `SMTP_PORT` | SMTP server port | _required if `SMTP_USE=true`_ | | ||
| `SMTP_USERNAME` | SMTP server authentication username | _required if `SMTP_USE=true`_ | | ||
| `SMTP_PASSWORD` | SMTP server authentication password | _required if `SMTP_USE=true`_ | | ||
| `SMTP_SENDER` | Email address used as sender in emails | _required if `SMTP_USE=true`_ | | ||
| `SMTP_BASE_URL` | Base URL for emails to link back to the application | _required if `SMTP_USE=true`_ | | ||
| `OPENSEARCH_USE` | Flag to enable OpenSearch integration | `false` | | ||
| `OPENSEARCH_NODE` | OpenSearch node URL | _required if `OPENSEARCH_USE=true`_ | | ||
| `OPENSEARCH_USERNAME` | OpenSearch username (if authentication is enabled) | _required if `OPENSEARCH_USE=true`_ | | ||
| `OPENSEARCH_PASSWORD` | OpenSearch password (if authentication is enabled) | _required if `OPENSEARCH_USE=true`_ | | ||
| `AUTO_MIGRATION` | Automatically perform database migration on application start | `true` | | ||
| `MASTER_API_KEY` | Master API key for privileged operations | _none_ | | ||
|
||
Please ensure that you set the required environment variables before starting the application. Optional variables can be set as needed based on your specific configuration and requirements. | ||
|
||
## Swagger | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,12 +18,36 @@ import Joi from 'joi'; | |
|
||
export const smtpConfigSchema = Joi.object({ | ||
SMTP_USE: Joi.boolean().default(false), | ||
SMTP_HOST: Joi.string().default('localhost'), | ||
SMTP_PORT: Joi.number().default(25), | ||
SMTP_USERNAME: Joi.string().default(''), | ||
SMTP_PASSWORD: Joi.string().default(''), | ||
SMTP_SENDER: Joi.string().default('[email protected]'), | ||
SMTP_BASE_URL: Joi.string().default('http://localhost:3000'), | ||
SMTP_HOST: Joi.string().when('SMTP_USE', { | ||
is: true, | ||
then: Joi.required(), | ||
otherwise: Joi.optional(), | ||
}), | ||
SMTP_PORT: Joi.number().when('SMTP_USE', { | ||
is: true, | ||
then: Joi.required(), | ||
otherwise: Joi.optional(), | ||
}), | ||
SMTP_USERNAME: Joi.string().when('SMTP_USE', { | ||
is: true, | ||
then: Joi.required(), | ||
otherwise: Joi.optional(), | ||
}), | ||
SMTP_PASSWORD: Joi.string().when('SMTP_USE', { | ||
is: true, | ||
then: Joi.required(), | ||
otherwise: Joi.optional(), | ||
}), | ||
SMTP_SENDER: Joi.string().when('SMTP_USE', { | ||
is: true, | ||
then: Joi.required(), | ||
otherwise: Joi.optional(), | ||
}), | ||
SMTP_BASE_URL: Joi.string().when('SMTP_USE', { | ||
is: true, | ||
then: Joi.required(), | ||
otherwise: Joi.optional(), | ||
}), | ||
}); | ||
|
||
export const smtpConfig = registerAs('smtp', () => ({ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
NEXT_PUBLIC_API_BASE_URL= | ||
API_BASE_URL= | ||
SESSION_PASSWORD= | ||
NEXT_PUBLIC_MAX_DAYS= | ||
NEXT_PUBLIC_API_BASE_URL=http://localhost:4000 | ||
API_BASE_URL=http://127.0.0.1:4000 | ||
SESSION_PASSWORD=mysupersessionpasswordatleast32characterslong | ||
NEXT_PUBLIC_MAX_DAYS=90 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ services: | |
environment: | ||
- JWT_SECRET=jwtsecretjwtsecretjwtsecret | ||
- MYSQL_PRIMARY_URL=mysql://userfeedback:[email protected]:13307/e2e | ||
- MYSQL_SECONDARY_URLS=["mysql://userfeedback:userfeedback@host.docker.internal:13307/e2e"] | ||
- BASE_URL=http://host.docker.internal:3000 | ||
- SMTP_HOST=localhost | ||
- SMTP_PORT=25 | ||
- [email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,15 +36,12 @@ services: | |
environment: | ||
- JWT_SECRET=jwtsecretjwtsecretjwtsecret | ||
- MYSQL_PRIMARY_URL=mysql://userfeedback:userfeedback@mysql:3306/userfeedback | ||
- MYSQL_SECONDARY_URLS=["mysql://userfeedback:userfeedback@mysql:3306/userfeedback"] | ||
- SMTP_HOST=smtp4dev | ||
- SMTP_PORT=25 | ||
- [email protected] | ||
- SMTP_BASE_URL=http://localhost:3000 | ||
- BASE_URL=http://api:3000 | ||
- ACCESS_TOKEN_EXPIRED_TIME=10m | ||
- REFESH_TOKEN_EXPIRED_TIME=1h | ||
- APP_PORT=4000 | ||
- APP_ADDRESS=api | ||
- AUTO_MIGRATION=true | ||
- MASTER_API_KEY=MASTER_API_KEY | ||
- NODE_OPTIONS="--max_old_space_size=3072" | ||
networks: | ||
- app_network | ||
|
Oops, something went wrong.