Skip to content

Commit d53e040

Browse files
authored
Fixed test, improved docs and added test step to circle pipeline (#26)
1 parent 9ac15fa commit d53e040

File tree

3 files changed

+66
-15
lines changed

3 files changed

+66
-15
lines changed

.circleci/config.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,37 @@ commands:
3030
docker push gaardsholt/$CIRCLE_PROJECT_REPONAME --all-tags
3131
3232
jobs:
33+
test:
34+
executor: go_image
35+
steps:
36+
- checkout
37+
- run:
38+
name: Download needed tools
39+
command: |
40+
go install gotest.tools/gotestsum@latest
41+
- run:
42+
name: go mod download
43+
command: go mod download
44+
- run:
45+
name: go vet
46+
when: always
47+
command: go vet ./...
48+
- run:
49+
name: go fmt
50+
when: always
51+
command: |
52+
gofmt -d -e .
53+
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
54+
exit 1
55+
fi
56+
- run:
57+
name: go test
58+
when: always
59+
command: |
60+
mkdir junit
61+
gotestsum --junitfile junit/unit-tests.xml
62+
- store_test_results:
63+
path: ~/project/junit
3364
build:
3465
executor: go_image
3566
steps:
@@ -51,15 +82,24 @@ jobs:
5182

5283

5384
workflows:
54-
build:
85+
test_n_build:
5586
jobs:
87+
- test:
88+
context: gaardsholt
89+
filters:
90+
tags:
91+
ignore: /^v([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
5692
- build:
5793
context: gaardsholt
94+
requires:
95+
- test
5896
filters:
5997
tags:
6098
ignore: /^v([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
6199
- build_docker:
62100
context: gaardsholt
101+
requires:
102+
- test
63103
filters:
64104
tags:
65105
ignore: /^v([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/

README.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,37 @@ The main application uses port `8080`.
88
## Server config
99

1010
The following config can be set via environment variables
11-
| Tables | Required | Default |
12-
| ----------------------------- | :------: | --------- |
13-
| [SERVERSALT](#SERVERSALT) | | |
14-
| [DATABASETYPE](#DATABASETYPE) | | in-memory |
15-
| [REDISSERVER](#REDISSERVER) | | localhost |
16-
| [REDISPORT](#REDISPORT) | | 6379 |
17-
18-
19-
### SERVERSALT
11+
| Tables | Required | Default |
12+
| ------------------------------- | :------: | --------- |
13+
| [SERVER_SALT](#SERVER_SALT) | | |
14+
| [DATABASE_TYPE](#DATABASE_TYPE) | | in-memory |
15+
| [REDIS_SERVER](#REDIS_SERVER) | | localhost |
16+
| [REDIS_PORT](#REDIS_PORT) | | 6379 |
17+
| [SERVER_PORT](#SERVER_PORT) | | 8080 |
18+
| [HEALTH_PORT](#HEALTH_PORT) | | 8888 |
19+
| [LOG_LEVEL](#LOG_LEVEL) | | info |
20+
21+
22+
### SERVER_SALT
2023
For extra security you can add your own salt when encrypting the data.
2124

22-
### DATABASETYPE
25+
### DATABASE_TYPE
2326
Can either be `in-memory` or `redis`.
2427

25-
### REDISSERVER
28+
### REDIS_SERVER
2629
Address to your redis server.
2730

28-
### REDISPORT
31+
### REDIS_PORT
2932
Used to specify the port your redis server is using.
3033

34+
### SERVER_PORT
35+
Listen port for api and ui endpoint.
36+
37+
### HEALTH_PORT
38+
Listen port for health endpoint, used mainly for liveness probes.
39+
40+
### LOG_LEVEL
41+
Used to specify loglevels, valid values are: `debug`, `info`, `warn` and `error`
3142

3243
## Create a new secret
3344

config/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
func TestLoadConfigAsExpected(t *testing.T) {
1212
// arrange
1313
os.Clearenv()
14-
os.Setenv("SERVERSALT", "somesalt")
15-
os.Setenv("DATABASETYPE", "redis")
14+
os.Setenv("SERVER_SALT", "somesalt")
15+
os.Setenv("DATABASE_TYPE", "redis")
1616

1717
// act
1818
LoadConfig()

0 commit comments

Comments
 (0)