Compare commits

..

1 Commits

Author SHA1 Message Date
c48bfe5c8e Mise à jour de 'main.go'
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-09 12:11:19 +02:00
3 changed files with 6 additions and 10 deletions

View File

@ -8,4 +8,4 @@ steps:
SEELF_API_KEY:
from_secret: seelf_api_key
commands:
- /bin/sh -c 'curl -X POST -H "Content-Type:application/json" -H "Authorization:Bearer $SEELF_API_KEY" -d "{\"environment\":\"staging\",\"git\":{\"branch\":\"$DRONE_BRANCH\",\"hash\":\"$DRONE_COMMIT\"}}" https://seelf.voixdunet.com/api/v1/apps/2PvP5liIhcMn59yo5q6m53QWWXM/deployments'
- /bin/sh -c 'curl -X POST -H "Content-Type:application/json" -H "Authorization:Bearer $SEELF_API_KEY" -d "{\"environment\":\"staging\",\"git\":{\"branch\":\"$DRONE_BRANCH\",\"hash\":\"$DRONE_COMMIT\"}}" https://seelf.voixdunet.com/api/v1/apps/2P5woMQ7sPQQMktVRl08wfJL6b5/deployments'

View File

@ -13,8 +13,6 @@ services:
image: postgres:14-alpine
volumes:
- dbdata:/var/lib/postgresql/data
ports:
- "5432:5432/tcp"
environment:
- POSTGRES_USER=app
- POSTGRES_PASSWORD=apppa55word

12
main.go
View File

@ -14,7 +14,7 @@ func main() {
dsn := os.Getenv("DSN")
if dsn == "" {
panic("db connection string should be set with the DSN env variable!")
panic("db connection string should be set with the DSN env variable!!")
}
db, err := sql.Open("postgres", dsn)
@ -64,9 +64,8 @@ INSERT INTO runs(date) VALUES (now());
}
ctx.JSON(http.StatusOK, response{
Description: "Simple application which logs in a database the date of each run and exposes environment variables to test seelf.",
Env: os.Environ(),
Runs: results,
Env: os.Environ(),
Runs: results,
})
})
@ -81,7 +80,6 @@ type data struct {
}
type response struct {
Description string `json:"description"`
Env []string `json:"env"`
Runs []data `json:"runs"`
Env []string `json:"env"`
Runs []data `json:"runs"`
}