diff options
author | Saumit Dinesan <justsaumit@protonmail.com> | 2023-12-25 00:12:29 +0530 |
---|---|---|
committer | Saumit Dinesan <justsaumit@protonmail.com> | 2023-12-25 00:12:29 +0530 |
commit | f15da3209e65dcff8f2836e5d3ce4179b3117426 (patch) | |
tree | a821ea906dc264cd2dcd06e8ecc6573ae70f515f | |
parent | 553e8f8a15ec52ae704ac84692a72c1f92200ff2 (diff) |
README.md: Adding Usage instructions and .env.example
-rw-r--r-- | .env.example | 8 | ||||
-rw-r--r-- | README.md | 26 |
2 files changed, 23 insertions, 11 deletions
diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..3642216 --- /dev/null +++ b/.env.example @@ -0,0 +1,8 @@ +ENVIRONMENT= +API_ENDPOINT_URL= +DOMAIN= +PORT= + +# SSL/TLS Configuration +CERTPATH= +KEYPATH= @@ -29,7 +29,7 @@ To get started with this project, follow these steps: ``` 3. Create a `.env` file at the root of the project and specify the environment variables. Default values will be used if not set. - For example: + For example (refer to env.example): ```dotenv ENVIRONMENT=production @@ -37,7 +37,7 @@ To get started with this project, follow these steps: DOMAIN=draconyan.xyz PORT=3000 - # SSL/TLS Configuration + # SSL/TLS Configuration (if running in container, make it /certs/<cert/key>.pem and mount the certificate directory as a volume to /certs) CERTPATH=<path to>/fullchain.pem KEYPATH=<path to>/privkey.pem ``` @@ -59,18 +59,22 @@ To get started with this project, follow these steps: CGO_ENABLED=1 go build -o main . ./main ``` - This sequence of commands builds the application and then runs the compiled binary `main` + This sequence of commands builds the application and then runs the compiled binary `main`. c. **Using Docker:** - With the help of Dockerfile - ```bash - docker build -t myapp . - ``` - ```bash - docker run -p 3000:3000 --env-file .env myapp - ``` - + - With the help of Dockerfile: + ```bash + docker build -t myapp . + - Run the image + - For `development` environment: + ```bash + docker run -p 3000:3000 myapp + ``` + - For `production` environment with specified certificate and private key paths: + ```bash + docker run -p 3000:3000 -v /path/to/certifcates:/certs myapp + ``` ### Usage Once the server is running, you can access the API endpoints to upload a file for hashing and verify them. |