mirror of
https://github.com/ferdzo/iotDashboard.git
synced 2026-04-05 09:06:26 +00:00
Functioning mqtt ingestion and db write, formating changes, device manager initiated
This commit is contained in:
@@ -1,6 +1,26 @@
|
||||
def main():
|
||||
print("Hello from device-manager!")
|
||||
from fastapi import FastAPI
|
||||
|
||||
from cert_manager import CertificateManager
|
||||
from models import DeviceRegistrationRequest, DeviceRegistrationResponse
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
cert_manager = CertificateManager()
|
||||
|
||||
@app.get("/")
|
||||
async def hello():
|
||||
return {"Hello": "World"}
|
||||
|
||||
@app.post("/devices/register")
|
||||
async def register_device(request: DeviceRegistrationRequest) -> DeviceRegistrationResponse:
|
||||
"""
|
||||
Register a new device and issue an X.509 certificate.
|
||||
"""
|
||||
response = cert_manager.register_device(
|
||||
name=request.name,
|
||||
location=request.location,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
return response
|
||||
|
||||
|
||||
Reference in New Issue
Block a user