Skip to content

Commit

Permalink
Merge pull request #193 from blbaker3/feat/multi-instance-signing
Browse files Browse the repository at this point in the history
Add Multi-instance Signing
  • Loading branch information
fescobar committed Aug 29, 2022
2 parents d7f9e13 + 7122565 commit 7ed39ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Table of contents
* [Roles](#roles)
* [Make Viewer endpoints public](#make-viewer-endpoints-public)
* [Scripts](#scripts)
* [Multi-instance Setup](#multi-instance-setup)
* [Add Custom URL Prefix](#add-custom-url-prefix)
* [Optimize Storage](#optimize-storage)
* [Export Native Full Report](#export-native-full-report)
Expand Down Expand Up @@ -1198,6 +1199,9 @@ python send_results_security.py
- Declarative Pipeline script for JENKINS with security enabled: [allure-docker-api-usage/send_results_security_jenkins_pipeline.groovy](allure-docker-api-usage/send_results_security_jenkins_pipeline.groovy)
#### Multi-instance Setup
`Available from Allure Docker Service version 2.18.0`
If you wish to use a setup with multiple instances, you will need to set `JWT_SECRET_KEY` env variables. Otherwise, requests may respond with `Invalid Token - Signature verification failed`.
#### Add Custom URL Prefix
`Available from Allure Docker Service version 2.13.5`
Expand Down
6 changes: 5 additions & 1 deletion allure-docker-api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def __str__(self):
app = Flask(__name__) #pylint: disable=invalid-name

LOGGER = create_logger(app)
app.config['JWT_SECRET_KEY'] = os.urandom(16)
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
app.config['JWT_BLACKLIST_ENABLED'] = True
app.config['JWT_BLACKLIST_TOKEN_CHECKS'] = ['access', 'refresh']
Expand Down Expand Up @@ -234,6 +233,11 @@ def __str__(self):
except Exception as ex:
LOGGER.error('Wrong env var value. Setting VIEWER_ENDPOINTS_PUBLIC=0 by default')

if "JWT_SECRET_KEY" in os.environ:
app.config['JWT_SECRET_KEY'] = os.environ['JWT_SECRET_KEY']
else:
app.config['JWT_SECRET_KEY'] = os.urandom(16)

if "SECURITY_USER" in os.environ:
SECURITY_USER_TMP = os.environ['SECURITY_USER']
if SECURITY_USER_TMP and SECURITY_USER_TMP.strip():
Expand Down

0 comments on commit 7ed39ae

Please sign in to comment.