Skip to content
Snippets Groups Projects
Commit a5cf1846 authored by Bastien Abadie's avatar Bastien Abadie Committed by Erwan Rouchet
Browse files

Support new license features

parent bf59c29a
No related branches found
No related tags found
1 merge request!2011Support new license features
......@@ -229,5 +229,6 @@ def get_settings_parser(base_dir):
license_parser = parser.add_subparser('license', default={})
license_parser.add_option('key', type=str, default=None)
license_parser.add_option('ping_frequency', type=int, default=1800)
license_parser.add_option('hostname', type=str, default=None)
return parser
......@@ -130,6 +130,7 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'teklia_license.django.LicenseCheckMiddleware',
]
ROOT_URLCONF = 'arkindex.project.urls'
......@@ -553,6 +554,7 @@ FRONTEND_BANNER = conf['banner']
# License management
LICENSE_KEY = conf['license']['key']
LICENSE_PING_FREQUENCY = conf['license']['ping_frequency']
LICENSE_HOSTNAME = conf['license']['hostname']
# Specific setting to enable GitLab webhook when using PageKite, it should not be used in production.
# It is used to change GitLab webhook URLs to go through a specified PageKite domain instead of localhost.
......
......@@ -103,6 +103,19 @@ class FixtureMixin(object):
fixtures = ['data.json', ]
@classmethod
def setUpClass(cls):
super().setUpClass()
# Disable license check from middleware when running API queries in unit tests
#
# This cannot be moved to arkindex.project.settings, unlike every other unit test setting override,
# because tests can be excluded from the compiled code and should not leave this disabling in place.
#
# This can still cause errors if a unit test class that does not use this mixin is run standalone,
# or is run before any test class using the mixin runs.
if 'teklia_license.django.LicenseCheckMiddleware' in settings.MIDDLEWARE:
settings.MIDDLEWARE.remove('teklia_license.django.LicenseCheckMiddleware')
@classmethod
def setUpTestData(cls):
super().setUpTestData()
......
......@@ -61,6 +61,7 @@ job_timeouts:
worker_results_delete: 3600
jwt_signing_key: null
license:
hostname: null
key: null
ping_frequency: 1800
local_imageserver_id: 1
......
......@@ -44,6 +44,7 @@ job_timeouts:
worker_results_delete: null
jwt_signing_key: null
license:
hostname: deadbeef
key: arkindex-test-deadbeef1234
ping_frequency: plop
local_imageserver_id: 1
......
......@@ -75,6 +75,7 @@ job_timeouts:
worker_results_delete: 8
jwt_signing_key: deadbeef
license:
hostname: deadbeef
key: arkindex-test-deadbeef1234
ping_frequency: 120
local_imageserver_id: 45
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment