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
INFLUX_DATABASE=provence
REST_PORT=8080
REST_USERNAME=
REST_PASSWORD=

View File

@@ -1,16 +1,17 @@
@host = https://api.db.e.kb28.ch
@room-id = B3
@username = user
@password = password
@username = PIE2EEDA
@password =
### 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}}
### GET history of a room
@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}}
### GET all rooms
GET http://localhost:8080/api/v1/rooms
GET http://{{host}}/api/v1/rooms
Authorization: Basic {{username}} {{password}}

View File

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

View File

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

View File

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

View File

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

View File

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