From f15da3209e65dcff8f2836e5d3ce4179b3117426 Mon Sep 17 00:00:00 2001 From: Saumit Dinesan Date: Mon, 25 Dec 2023 00:12:29 +0530 Subject: README.md: Adding Usage instructions and .env.example --- .env.example | 8 ++++++++ README.md | 26 +++++++++++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 .env.example 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= diff --git a/README.md b/README.md index 9a158f0..df22c95 100644 --- a/README.md +++ b/README.md @@ -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/.pem and mount the certificate directory as a volume to /certs) CERTPATH=/fullchain.pem KEYPATH=/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. -- cgit v1.2.3