Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
9f8b923a
Commit
9f8b923a
authored
Jul 21, 2020
by
Manuel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restGateway: added SSL certificate to Flask config
certificates itself are ignored for safety reasons
parent
2cfcbf6a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
.gitignore
.gitignore
+6
-0
main.py
src/rest-gateway/app/main.py
+14
-3
No files found.
.gitignore
View file @
9f8b923a
...
...
@@ -4,3 +4,9 @@
*.log
**/env
**/venv
src/modules/certificate/articonf1.key
src/modules/certificate/articonf1.crt
src/modules/certificate/articonf1-chain.crt
src/rest-gateway/app/main.py
View file @
9f8b923a
...
...
@@ -18,15 +18,20 @@ LOGGER = logging.getLogger(__name__)
#################################
import
connexion
# load swagger config
def
get_bundled_specs
(
main_file
:
Path
)
->
Dict
[
str
,
Any
]:
'''
parses the given swagger.yml file and resolves dependencies
from that file to enable the possibility to split the
configuration into several files
'''
parser
=
prance
.
ResolvingParser
(
str
(
main_file
.
absolute
()),
lazy
=
True
,
backend
=
'openapi-spec-validator'
)
parser
.
parse
()
return
parser
.
specification
# load swagger config
app
=
connexion
.
App
(
__name__
,
specification_dir
=
'configs/'
)
# app.add_api('swagger.yml')
app
.
add_api
(
get_bundled_specs
(
Path
(
"configs/swagger.yml"
)),
resolver
=
connexion
.
RestyResolver
(
"cms_rest_api"
))
...
...
@@ -35,6 +40,12 @@ app.add_api(get_bundled_specs(Path("configs/swagger.yml")),
def
api_root
():
return
'Endpoint of SMART RESTful API Gateway!'
# SSL configuration
context
=
(
'../../modules/certificate/articonf1.crt'
,
'../../modules/certificate/articonf1.key'
)
# certificate and key files
# start app
if
__name__
==
'__main__'
:
app
.
run
(
host
=
'0.0.0.0'
,
port
=
5000
,
debug
=
True
,
use_reloader
=
False
)
# disable reloader so only subscribed once to rabbitmq
\ No newline at end of file
# app.run(host='0.0.0.0', port=5000, debug=True, use_reloader=False) # disable reloader so only subscribed once to rabbitmq
app
.
run
(
host
=
'0.0.0.0'
,
port
=
5000
,
debug
=
True
,
use_reloader
=
False
,
ssl_context
=
context
)
# disable reloader so only subscribed once to rabbitmq
\ No newline at end of file
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