diff --git a/db/.env.template b/db/.env.template index 00c7c5c..b299cda 100644 --- a/db/.env.template +++ b/db/.env.template @@ -2,7 +2,6 @@ INFLUX_PORT=8181 UI_PORT=8093 INFLUX_DATABASE=provence -REST_PORT=8080 REST_USERNAME= REST_PASSWORD= diff --git a/db/get-db.http b/db/get-db.http index 64d98d0..cb496b3 100644 --- a/db/get-db.http +++ b/db/get-db.http @@ -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}} diff --git a/db/src/docs/docs.go b/db/src/docs/docs.go index c31d1ae..481b026 100644 --- a/db/src/docs/docs.go +++ b/db/src/docs/docs.go @@ -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", diff --git a/db/src/docs/swagger.json b/db/src/docs/swagger.json index 32a16ae..83b9b0c 100644 --- a/db/src/docs/swagger.json +++ b/db/src/docs/swagger.json @@ -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": { diff --git a/db/src/docs/swagger.yaml b/db/src/docs/swagger.yaml index 32e961e..97e9e8c 100644 --- a/db/src/docs/swagger.yaml +++ b/db/src/docs/swagger.yaml @@ -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. diff --git a/db/src/main.go b/db/src/main.go index ea07cfd..af85113 100644 --- a/db/src/main.go +++ b/db/src/main.go @@ -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() { diff --git a/db/traefik.yml b/db/traefik.yml index 339fb13..6359e15 100644 --- a/db/traefik.yml +++ b/db/traefik.yml @@ -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"