Skip to content

Commit df34390

Browse files
committed
improve example and add tests
1 parent cf1b3c3 commit df34390

11 files changed

Lines changed: 115 additions & 57 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"image": "ghcr.io/codetent/confless/dev:sha-382640a",
2+
"image": "ghcr.io/codetent/confless/dev:sha-6fd6dc8",
33
"runArgs": [
44
"--platform=linux/amd64"
55
],

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
check:
1414
runs-on: ubuntu-latest
1515
container:
16-
image: ghcr.io/codetent/confless/dev:sha-382640a
16+
image: ghcr.io/codetent/confless/dev:sha-6fd6dc8
1717
env:
1818
GOFLAGS: -buildvcs=false
1919
steps:

Taskfile.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
version: '3'
22

3+
includes:
4+
examples:
5+
dir: examples
6+
taskfile: examples/Taskfile.yml
7+
38
tasks:
49
test:
510
cmds:
6-
- go test -v ./...
11+
- gotestsum --format testdox
12+
- task: examples:test
713

814
lint:
915
cmds:

example/config.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

example/main.go

Lines changed: 0 additions & 45 deletions
This file was deleted.

example/other.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/Taskfile.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: '3'
2+
3+
tasks:
4+
test:
5+
cmds:
6+
- cmd: |
7+
cd {{ .ITEM.dir }} &&
8+
{{ .ITEM.cmd }} | jd {{ .ITEM.expected }}
9+
for:
10+
- dir: simple
11+
cmd: >-
12+
APP_DATABASE_USERNAME=user
13+
APP_DATABASE_PASSWORD=pass
14+
go run main.go
15+
--debug
16+
--config=files/override.yaml
17+
expected: expected.json

examples/simple/expected.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "app",
3+
"host": "0.0.0.0",
4+
"port": 8080,
5+
"debug": true,
6+
"database": {
7+
"host": "db.example.com",
8+
"port": 5432,
9+
"username": "user",
10+
"password": "pass"
11+
},
12+
"Config": "files/override.yaml"
13+
}

examples/simple/files/config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "app",
3+
"host": "0.0.0.0",
4+
"port": 8080
5+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
database:
2+
host: db.example.com
3+
port: 5432
4+
ssl: true

0 commit comments

Comments
 (0)