A simple Fruits REST API built in golang
using Labstack's Echo.
- For RDBMS(PostgreSQL,MySQL/MariaDB) demo use the main branch
- NoSQL(MongoDB) please switch to mongodb branch.
Copy the .env.example
to .env
and update the following variables to suit your settings.
PLUGIN_REGISTRY
- the docker registry to usePLUGIN_TAG
- the tag to push the image to docker registryPLUGIN_REPO
- the docker registry repositoryPLUGIN_USERNAME
- the docker Registry usernamePLUGIN_PASSWORD
- the docker registry password
FRUITS_DB_TYPE
- the database to use with fruits api, defaults:sqlite
POSTGRES_HOST
- the postgresql host usually the docker or kubernetes service name e.g.postgresql
POSTGRES_PORT
- the postgresql port e.g.5432
POSTGRES_USER
- the postgresql user e.g.demo
POSTGRES_PASSWORD
- the postgresql password e.gpa55Word!
POSTGRES_DB
- the postgresql database to use e.gdemodb
MYSQL_HOST
- the MySQL host usually the docker or kubernetes service name e.g.mysql
MYSQL_PORT
- the MySQL port e.g.3306
MYSQL_ROOT_PASSWORD
- the MySQL root passwordsuperS3cret!
MYSQL_PASSWORD
- the MySQL passwordpa55Word!
MYSQL_USER
- the MySQL user e.gdemo
MYSQL_DATABASE
- the MySQL database to use e.gdemodb
FRUITS_DB_FILE
- the default database file to use.
NOTE:
- Most of the above database settings comes from how you setup the datbase. Please update accordingly
- If you use FRUITS_DB_FILE to use for testing.
Set the FRUIT_DB_TYPE
to pgsql
or mysql
to run tests against those databases. As by default all the tests are performed against SQLite
.
drone exec --trusted --env-file=.env
The command will test, build and push the container image to the $PLUGIN_REPO:$PLUGIN_TAG
.
docker-compose up
The application provides a Swagger UI that can be used to used to play with the API.