docs: update setup database
This commit is contained in:
parent
cb3d06fa02
commit
bd305f0edf
@ -3,3 +3,10 @@ DB_USER=
|
||||
DB_PASSWORD=
|
||||
DB_NAME=
|
||||
DB_PORT=
|
||||
|
||||
REDIS_HOST=
|
||||
REDIS_USERNAME=
|
||||
REDIS_PORT=
|
||||
REDIS_PASSWORD=
|
||||
REDIS_TTL=
|
||||
REDIS_DB=
|
||||
|
||||
24
README.md
24
README.md
@ -76,6 +76,30 @@ Run the following command to download and resolve all dependencies specified in
|
||||
go mod tidy
|
||||
```
|
||||
|
||||
## Setup Database
|
||||
|
||||
In your Go application, you'll need to set the following environment variables to connect to your database:
|
||||
```bash
|
||||
DB_HOST: The hostname or IP address of your database server (e.g., localhost, 127.0.0.1, or the actual DB server URL).
|
||||
DB_USER: The username for your database connection.
|
||||
DB_PASSWORD: The password associated with the DB_USER.
|
||||
DB_NAME: The name of the database you want to connect to.
|
||||
DB_PORT: The port number your database server is running on (default MySQL port is 3306, default PostgreSQL port is 5432).
|
||||
```
|
||||
|
||||
## Create `.env` File
|
||||
|
||||
It's best practice to keep sensitive information like database credentials in an environment file. Create or edit the .env file in the root directory of your project and add the following lines:
|
||||
|
||||
```bash
|
||||
DB_HOST=localhost
|
||||
DB_USER=your_db_user
|
||||
DB_PASSWORD=your_db_password
|
||||
DB_NAME=your_db_name
|
||||
DB_PORT=3306 # or 5432, depending on your DB type
|
||||
Make sure to replace the values with your actual database details.
|
||||
```
|
||||
|
||||
## Build the Binary Using `make build`
|
||||
|
||||
Run the following command to build your project. The binary will be placed in the `bin` folder.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user