Skip to content

Commit

Permalink
Fixed test, improved docs and added test step to circle pipeline (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
brondum authored Oct 27, 2022
1 parent 9ac15fa commit d53e040
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 15 deletions.
42 changes: 41 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,37 @@ commands:
docker push gaardsholt/$CIRCLE_PROJECT_REPONAME --all-tags
jobs:
test:
executor: go_image
steps:
- checkout
- run:
name: Download needed tools
command: |
go install gotest.tools/gotestsum@latest
- run:
name: go mod download
command: go mod download
- run:
name: go vet
when: always
command: go vet ./...
- run:
name: go fmt
when: always
command: |
gofmt -d -e .
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
exit 1
fi
- run:
name: go test
when: always
command: |
mkdir junit
gotestsum --junitfile junit/unit-tests.xml
- store_test_results:
path: ~/project/junit
build:
executor: go_image
steps:
Expand All @@ -51,15 +82,24 @@ jobs:


workflows:
build:
test_n_build:
jobs:
- test:
context: gaardsholt
filters:
tags:
ignore: /^v([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
- build:
context: gaardsholt
requires:
- test
filters:
tags:
ignore: /^v([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
- build_docker:
context: gaardsholt
requires:
- test
filters:
tags:
ignore: /^v([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
Expand Down
35 changes: 23 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,37 @@ The main application uses port `8080`.
## Server config

The following config can be set via environment variables
| Tables | Required | Default |
| ----------------------------- | :------: | --------- |
| [SERVERSALT](#SERVERSALT) | | |
| [DATABASETYPE](#DATABASETYPE) | | in-memory |
| [REDISSERVER](#REDISSERVER) | | localhost |
| [REDISPORT](#REDISPORT) | | 6379 |


### SERVERSALT
| Tables | Required | Default |
| ------------------------------- | :------: | --------- |
| [SERVER_SALT](#SERVER_SALT) | | |
| [DATABASE_TYPE](#DATABASE_TYPE) | | in-memory |
| [REDIS_SERVER](#REDIS_SERVER) | | localhost |
| [REDIS_PORT](#REDIS_PORT) | | 6379 |
| [SERVER_PORT](#SERVER_PORT) | | 8080 |
| [HEALTH_PORT](#HEALTH_PORT) | | 8888 |
| [LOG_LEVEL](#LOG_LEVEL) | | info |


### SERVER_SALT
For extra security you can add your own salt when encrypting the data.

### DATABASETYPE
### DATABASE_TYPE
Can either be `in-memory` or `redis`.

### REDISSERVER
### REDIS_SERVER
Address to your redis server.

### REDISPORT
### REDIS_PORT
Used to specify the port your redis server is using.

### SERVER_PORT
Listen port for api and ui endpoint.

### HEALTH_PORT
Listen port for health endpoint, used mainly for liveness probes.

### LOG_LEVEL
Used to specify loglevels, valid values are: `debug`, `info`, `warn` and `error`

## Create a new secret

Expand Down
4 changes: 2 additions & 2 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
func TestLoadConfigAsExpected(t *testing.T) {
// arrange
os.Clearenv()
os.Setenv("SERVERSALT", "somesalt")
os.Setenv("DATABASETYPE", "redis")
os.Setenv("SERVER_SALT", "somesalt")
os.Setenv("DATABASE_TYPE", "redis")

// act
LoadConfig()
Expand Down

0 comments on commit d53e040

Please sign in to comment.