Backend serivce for StampWallet app. Requires Go 1.20
Make sure that api git submodule is initialised: git submodule init && git submodule update
.
Or clone with --recurse-submodules
- Install openapi-generator
- Run scripts/generateApi.sh from the directory where openapi-generator jar is stored
- Install Go 1.20
make
ormake bin
to just build the binary and skip all tests- Run
./stampWalletServer example-config
to generate example config
Tests require a working Postgres database with PostGIS extensions. Two environment variables are required to configure the tests:
- TEST_DATABASE_URL - Database URL, for example
postgres://postgres@localhost/stampwallet
- TEST_DATABASE_NAME - Test database name, for example
stampwallet
. NOTE: This database will be dropped and recreated repeatedly. All data from this database WILL be lost.
To set up a Postgres database on docker with PostGIS (example): sudo docker run -e POSTGRES_HOST_AUTH_METHOD=trust -p 5432:5432 -d postgis/postgis
go test -v ./...
ortest . -run "^TestBusiness.*$"
to only run tests that match a string
example-config
subcommand will generate an example configuration file.
BackendDomain: localhost # ?
DatabaseUrl: 'postgresql://user:password@localhost/db' # Postgres database URL
EmailVerificationFrontendURL: localhost # URL of email verification website
ServerUrl: localhost:8080 # IP and port the server will listen on (TODO: change name)
SmtpConfig:
ServerHostname: smtp.example.com # SMTP Server hostname
ServerPort: 465 # SMTP Server port
Username: [email protected] # SMTP auth username
Password: 'password' # SMTP auth password
SenderEmail: [email protected] # Email Address to put in "from" field
StoragePath: /tmp/ # Where to store uploaded files
To build Docker image, run sudo docker buildx build --progress=plain .
. Buildkit might be required.
Development docker-compose file is also provided. It will set up both the backend, and the database.
docker-compose -f docker-compose.yaml build
- build imagedocker-compose -f docker-compose.yaml start
- start the whole dev stack
To configure the server, copy docker-compose.dev.example.yaml
to docker-compose.dev.yaml
, change values in docker-compose.dev.yml
and add -f docker-compose.dev.yml
to next docker-compose runs.
sudo docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml up