You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project shows the use of Gin Framework in Golang.
3
+
4
+
This repository runs a simple main daemon (main) that implements a REST API for users. The daemon uses a postgres database to persist data and after creation uses migrations to create the user schema.
5
+
6
+
## Table of Contents
7
+
8
+
-[Running](#running)
9
+
-[Dependencies](#dependencies)
10
+
-[Environment Variables](#environment-variables)
11
+
-[Make Rule](#make-rule)
12
+
-[Testing](#testing)
13
+
- Coming soon
14
+
15
+
## Running
16
+
17
+
### Dependencies
18
+
19
+
The only dependencies to run the services in this repository are:
20
+
21
+
-`docker`
22
+
-`docker-compose`
23
+
24
+
### Environment Variables
25
+
26
+
The program looks for the following environment variables:
27
+
28
+
-`DB_USER`: The postgres database username that gets used within the postgres connection
29
+
string (Default: `root`).
30
+
-`DB_PASS`: The postgres database password that gets used within the postgres connection
31
+
string (Default: `root`).
32
+
-`DB_NAME`: The postgres database name that gets used within the postgres connection string
33
+
(Default: `user`).
34
+
-`DB_HOST`: The postgres database host name that gets used within the postgres connection
35
+
string (Default `db`).
36
+
-`DB_PORT`: The postgres database port that gets used within the postgres connection string
37
+
(Default: `5432`).
38
+
39
+
If the environment variable has a supplied default and none are set within the context of the host
40
+
machine, then the default will be used.
41
+
42
+
To set any given environment variable, simply execute the following
43
+
pattern, replacing `[ENV_NAME]` with the name of the environment variable and `[ENV_VALUE]` with the
44
+
desired value of the environment variable: `export [ENV_NAME]=[ENV_VALUE]`. To unset any set environment
45
+
variable, simply execute the following pattern, replacing `[ENV_NAME]` with the name of the environment
46
+
variable: `unset [ENV_NAME]`.
47
+
48
+
### Make Rule
49
+
50
+
To run the services simply execute the following command:
51
+
52
+
```shell
53
+
make run
54
+
```
55
+
56
+
This will stop any containers defined by the compose file if already running
57
+
and then rebuild the containers using the compose file. The main daemon (`main`)
58
+
will be available at `localhost:8080` and the postgres instance will be available
59
+
at `localhost:5432`.
60
+
61
+
To stop the services simply execute the following command:
62
+
63
+
```shell
64
+
make stop
65
+
```
66
+
67
+
To down the services simply execute the following command:
0 commit comments