Skip to content

Commit

Permalink
introduce double hostname to handle td and server start
Browse files Browse the repository at this point in the history
  • Loading branch information
egekorkan committed Oct 21, 2024
1 parent a94e45e commit a961596
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions things/calculator/http/flask/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

cli.show_server_banner = lambda *x: click.echo("ThingIsReady")

hostname = "0.0.0.0"
td_hostname = "0.0.0.0"
portNumber = 5000

if "HOSTNAME" in os.environ:
hostname = os.environ["HOSTNAME"]
td_hostname = os.environ["HOSTNAME"]

if "PORT" in os.environ:
portNumber = os.environ["PORT"]
Expand All @@ -44,7 +44,7 @@
thingModel["@type"] = 'Thing'
thingModel = json.dumps(thingModel)
thingModel = thingModel.replace('{{PROTOCOL}}', 'http')
thingModel = thingModel.replace('{{HOSTNAME}}', hostname)
thingModel = thingModel.replace('{{HOSTNAME}}', td_hostname)
thingModel = thingModel.replace('{{PROPERTIES}}', PROPERTIES)
thingModel = thingModel.replace('{{ACTIONS}}', ACTIONS)
thingModel = thingModel.replace('{{EVENTS}}', EVENTS)
Expand Down Expand Up @@ -158,4 +158,4 @@ def stream():
port = 5000

if __name__ == "__main__":
app.run(debug=False, host=hostname, port=port)
app.run(debug=False, host="0.0.0.0", port=port)

0 comments on commit a961596

Please sign in to comment.