Mise à jour de 'main.go'
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
dcb432c572
commit
67507b81f0
12
main.go
12
main.go
@ -14,7 +14,7 @@ func main() {
|
|||||||
dsn := os.Getenv("DSN")
|
dsn := os.Getenv("DSN")
|
||||||
|
|
||||||
if 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)
|
db, err := sql.Open("postgres", dsn)
|
||||||
@ -64,8 +64,9 @@ INSERT INTO runs(date) VALUES (now());
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx.JSON(http.StatusOK, response{
|
ctx.JSON(http.StatusOK, response{
|
||||||
Env: os.Environ(),
|
Description: "Simple application which logs in a database the date of each run and exposes environment variables to test seelf.",
|
||||||
Runs: results,
|
Env: os.Environ(),
|
||||||
|
Runs: results,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -80,6 +81,7 @@ type data struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type response struct {
|
type response struct {
|
||||||
Env []string `json:"env"`
|
Description string `json:"description"`
|
||||||
Runs []data `json:"runs"`
|
Env []string `json:"env"`
|
||||||
|
Runs []data `json:"runs"`
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user