fix(db): proper api url instead of using swagger doc url

Signed-off-by: Klagarge <remi@heredero.ch>
This commit is contained in:
2026-05-03 22:49:10 +02:00
parent 1678ac535b
commit 980b43e669
7 changed files with 19 additions and 12 deletions

View File

@@ -2,7 +2,6 @@ INFLUX_PORT=8181
UI_PORT=8093 UI_PORT=8093
INFLUX_DATABASE=provence INFLUX_DATABASE=provence
REST_PORT=8080
REST_USERNAME= REST_USERNAME=
REST_PASSWORD= REST_PASSWORD=

View File

@@ -1,16 +1,17 @@
@host = https://api.db.e.kb28.ch
@room-id = B3 @room-id = B3
@username = user @username = PIE2EEDA
@password = password @password =
### GET last value of temp, co2, humidity, windows states ### GET last value of temp, co2, humidity, windows states
GET http://localhost:8080/api/v1/rooms/{{room-id}}/current GET http://{{host}}/api/v1/rooms/{{room-id}}/current
Authorization: Basic {{username}} {{password}} Authorization: Basic {{username}} {{password}}
### GET history of a room ### GET history of a room
@window = 1 day @window = 1 day
GET http://localhost:8080/api/v1/rooms/{{room-id}}/history?window={{window}} GET http://{{host}}/api/v1/rooms/{{room-id}}/history?window={{window}}
Authorization: Basic {{username}} {{password}} Authorization: Basic {{username}} {{password}}
### GET all rooms ### GET all rooms
GET http://localhost:8080/api/v1/rooms GET http://{{host}}/api/v1/rooms
Authorization: Basic {{username}} {{password}} Authorization: Basic {{username}} {{password}}

View File

@@ -170,7 +170,7 @@ const docTemplate = `{
// SwaggerInfo holds exported Swagger Info so clients can modify it // SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{ var SwaggerInfo = &swag.Spec{
Version: "1.0", Version: "1.0",
Host: "doc.db.e.kb28.ch", Host: "api.db.e.kb28.ch",
BasePath: "/api/v1", BasePath: "/api/v1",
Schemes: []string{}, Schemes: []string{},
Title: "Gateway API", Title: "Gateway API",

View File

@@ -6,7 +6,7 @@
"contact": {}, "contact": {},
"version": "1.0" "version": "1.0"
}, },
"host": "doc.db.e.kb28.ch", "host": "api.db.e.kb28.ch",
"basePath": "/api/v1", "basePath": "/api/v1",
"paths": { "paths": {
"/rooms": { "/rooms": {

View File

@@ -1,5 +1,5 @@
basePath: /api/v1 basePath: /api/v1
host: doc.db.e.kb28.ch host: api.db.e.kb28.ch
info: info:
contact: {} contact: {}
description: This is a gateway API for IoT data. description: This is a gateway API for IoT data.

View File

@@ -87,7 +87,7 @@ func influxConnection() *influx.InfluxGateway {
// @title Gateway API // @title Gateway API
// @version 1.0 // @version 1.0
// @description This is a gateway API for IoT data. // @description This is a gateway API for IoT data.
// @host doc.db.e.kb28.ch // @host api.db.e.kb28.ch
// @BasePath /api/v1 // @BasePath /api/v1
// @securityDefinitions.basic BasicAuth // @securityDefinitions.basic BasicAuth
func main() { func main() {

View File

@@ -38,11 +38,18 @@ http:
service: pi-mqtt-management service: pi-mqtt-management
tls: tls:
certResolver: letsencrypt certResolver: letsencrypt
pi-db-api:
rule: "Host(`api.db.e.kb28.ch`)"
entryPoints:
- websecure
service: pi-db-api
tls:
certResolver: letsencrypt
pi-db-doc: pi-db-doc:
rule: "Host(`doc.db.e.kb28.ch`)" rule: "Host(`doc.db.e.kb28.ch`)"
entryPoints: entryPoints:
- websecure - websecure
service: pi-db-doc service: pi-db-api
tls: tls:
certResolver: letsencrypt certResolver: letsencrypt
middlewares: middlewares:
@@ -64,7 +71,7 @@ http:
servers: servers:
- url: "http://192.168.42.211:15672" - url: "http://192.168.42.211:15672"
passHostHeader: true passHostHeader: true
pi-db-doc: pi-db-api:
loadBalancer: loadBalancer:
servers: servers:
- url: "http://192.168.42.211:8080" - url: "http://192.168.42.211:8080"