Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Travel-Utilities-WWI21SEB/expense-management-service

Repository files navigation

expense-management-service

Continious Integration Continuous Delivery CodeScene Code Health

Backend Service for the Expense Management Tool

Developing

If you cloned the repository locally ensure that you have go 1.20 installed. To install the dependencies run the following command:

go mod download

After installing the dependencies you need to populate a local .env file in the root directory with the following variables:

# DEV:    For local development
# DOCKER: For builds with docker-compose
# PROD:   For prod builds or previews
ENVIRONMENT=DEV or DOCKER or PROD

# Secret key for generating JWT tokens
JWT_SECRET="some super long and secure secret"

# For dev database connection
DEV_DB_HOST=localhost
DEV_DB_PORT=5432
DEV_DB_USER=admin
DEV_DB_PASSWORD=password
DEV_DB_NAME=travel_expenses-db

# For docker network database connection
DOCKER_DB_HOST=expense-db-container
DOCKER_DB_PORT=5432
DOCKER_DB_USER=admin
DOCKER_DB_PASSWORD=password
DOCKER_DB_NAME=travel_expenses-db

# For prod database connection
PROD_DB_HOST=ask luca
PROD_DB_PORT=ask luca
PROD_DB_USER=ask luca
PROD_DB_PASSWORD=ask luca
PROD_DB_NAME=ask luca

# Mail Server
MAILGUN_API_KEY=ask kevin
MAILGUN_DOMAIN=mail.costventures.works

For the dev-enviroment you will also need a local postgres cluster running on port 5432 with the credentials as specified in the example above. The database itself should be setup with the expense_db.sql file in the root directory of this repository. More information on how to do this can be found here.

Building

To run the application in a local container run the following command:

bash ./scripts/start
# exposed at localhost:8081

To stop the container run the following command:

bash ./scripts/stop

To run the application locally without a container run the following command:

go run ./...
# exposed at localhost:8080

Contributing

To contribute to this template, clone this repository locally and commit your code on a separate branch. Try using conventional commits. When you're ready to submit your PR, check if your application builds by running the following commands:

go build ./...

Finally check if you can build and run the container:

bash ./scripts/start

If the checks pass open a pull request on the main branch. Once the pull request is approved and merged, your changes will be automatically deployed to production.

About

Backend Service for the Expense Management Tool

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages