Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Communications Backbone System
communications-backbone
Commits
c4cc874a
Commit
c4cc874a
authored
2 years ago
by
James Kirk
Browse files
Options
Download
Email Patches
Plain Diff
refactor: pass in flask host as an arg
parent
2271e3f1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
4 deletions
+6
-4
api.py
api.py
+5
-1
docker/docker-compose.yaml
docker/docker-compose.yaml
+1
-0
endpoints/token.py
endpoints/token.py
+0
-3
No files found.
api.py
View file @
c4cc874a
...
...
@@ -9,6 +9,8 @@ from endpoints.send import Send
from
endpoints.token
import
Token
from
models.token
import
TokenModel
import
os
token
=
TokenModel
()
token
.
setSecret
()
...
...
@@ -23,5 +25,7 @@ api.add_resource(Send, "/send")
api
.
add_resource
(
Notify
,
"/notify"
)
api
.
add_resource
(
Token
,
"/token"
)
flask_host
=
os
.
getenv
(
"FLASK_HOST"
,
"localhost"
)
# Sets to whatever MQ_HOST is, or defaults to localhost
if
__name__
==
"__main__"
:
app
.
run
(
debug
=
False
,
port
=
8087
,
host
=
"0.0.0.0"
)
app
.
run
(
debug
=
False
,
port
=
8087
,
host
=
flask_host
)
This diff is collapsed.
Click to expand it.
docker/docker-compose.yaml
View file @
c4cc874a
...
...
@@ -37,6 +37,7 @@ services:
-
rabbitmq__local
environment
:
-
MQ_HOST=rmq
-
FLASK_HOST=0.0.0.0
volumes
:
-
../:/app
command
:
"
api.py"
...
...
This diff is collapsed.
Click to expand it.
endpoints/token.py
View file @
c4cc874a
...
...
@@ -3,8 +3,6 @@ from flask_restful import Resource, request, abort
from
marshmallow
import
Schema
,
fields
from
models.token
import
TokenModel
import
os
class
TokenQuerySchema
(
Schema
):
client_id
=
fields
.
Str
(
required
=
True
)
secret
=
fields
.
Str
(
required
=
True
)
...
...
@@ -18,7 +16,6 @@ class Token(Resource):
def
__init__
(
self
):
self
.
schema
=
TokenQuerySchema
()
self
.
model
=
TokenModel
()
data_dir
=
os
.
getenv
(
"DATA_DIR"
,
"/data"
)
with
open
(
"./data/clients.json"
,
"r"
)
as
clients_file
:
self
.
clients
=
json
.
load
(
clients_file
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment