mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-12-12 14:17:46 +00:00
Add missing CMS config (just in case)
I don't think this affects the CMS behaviour, but SESSION_COOKIE_DOMAIN is used by the CMS, so rather be safe than sorry.
This commit is contained in:
parent
328cd2b1ac
commit
a7ab1c5ace
@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## Latest
|
||||||
|
|
||||||
|
- [Improvement] Support CMS login when the CMS is not a subdomain of the LMS
|
||||||
|
|
||||||
## 3.3.0 (2019-03-22)
|
## 3.3.0 (2019-03-22)
|
||||||
|
|
||||||
- [Feature] Upgrade from Hawthorn to Ironwood
|
- [Feature] Upgrade from Hawthorn to Ironwood
|
||||||
|
@ -164,6 +164,9 @@ def load_defaults(config):
|
|||||||
if k not in config:
|
if k not in config:
|
||||||
config[k] = v
|
config[k] = v
|
||||||
|
|
||||||
|
# Add extra configuration parameters that need to be computed separately
|
||||||
|
config["lms_cms_common_domain"] = utils.common_domain(config["LMS_HOST"], config["CMS_HOST"])
|
||||||
|
|
||||||
def ask(question, key, config):
|
def ask(question, key, config):
|
||||||
default = env.render_str(config, config[key])
|
default = env.render_str(config, config[key])
|
||||||
config[key] = click.prompt(
|
config[key] = click.prompt(
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
"EMAIL_PORT": {{ SMTP_PORT }},
|
"EMAIL_PORT": {{ SMTP_PORT }},
|
||||||
"HTTPS": "{{ "on" if ACTIVATE_HTTPS else "off" }}",
|
"HTTPS": "{{ "on" if ACTIVATE_HTTPS else "off" }}",
|
||||||
"LANGUAGE_CODE": "{{ LANGUAGE_CODE }}",
|
"LANGUAGE_CODE": "{{ LANGUAGE_CODE }}",
|
||||||
|
"SESSION_COOKIE_DOMAIN": ".{{ lms_cms_common_domain }}",
|
||||||
"CACHES": {
|
"CACHES": {
|
||||||
"default": {
|
"default": {
|
||||||
"KEY_PREFIX": "default",
|
"KEY_PREFIX": "default",
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
"LANGUAGE_CODE": "{{ LANGUAGE_CODE }}",
|
"LANGUAGE_CODE": "{{ LANGUAGE_CODE }}",
|
||||||
"LOGIN_REDIRECT_WHITELIST": ["{{ CMS_HOST }}", "studio.localhost"],
|
"LOGIN_REDIRECT_WHITELIST": ["{{ CMS_HOST }}", "studio.localhost"],
|
||||||
"SESSION_COOKIE_DOMAIN": ".{{ LMS_HOST }}",
|
"SESSION_COOKIE_DOMAIN": ".{{ lms_cms_common_domain }}",
|
||||||
"CACHES": {
|
"CACHES": {
|
||||||
"default": {
|
"default": {
|
||||||
"KEY_PREFIX": "default",
|
"KEY_PREFIX": "default",
|
||||||
|
@ -21,6 +21,22 @@ def parse_yaml_value(v):
|
|||||||
v = (v == "true")
|
v = (v == "true")
|
||||||
return v
|
return v
|
||||||
|
|
||||||
|
def common_domain(d1, d2):
|
||||||
|
"""
|
||||||
|
Return the common domain between two domain names.
|
||||||
|
|
||||||
|
Ex: "sub1.domain.com" and "sub2.domain.com" -> "domain.com"
|
||||||
|
"""
|
||||||
|
components1 = d1.split(".")[::-1]
|
||||||
|
components2 = d2.split(".")[::-1]
|
||||||
|
common = []
|
||||||
|
for c in range(0, min(len(components1), len(components2))):
|
||||||
|
if components1[c] == components2[c]:
|
||||||
|
common.append(components1[c])
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
return ".".join(common[::-1])
|
||||||
|
|
||||||
def docker_run(*command):
|
def docker_run(*command):
|
||||||
return docker("run", "--rm", "-it", *command)
|
return docker("run", "--rm", "-it", *command)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user