Skip to content

Commit

Permalink
chore: simplify settings
Browse files Browse the repository at this point in the history
  • Loading branch information
regisb authored and Faraz32123 committed Nov 30, 2023
1 parent a3d1ca8 commit a31f6b7
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 47 deletions.
16 changes: 0 additions & 16 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,43 +56,27 @@ Application configuration
- ``CREDENTIALS_MYSQL_PASSWORD`` (default: ``"{{ 8|random_string }}"``)
- ``CREDENTIALS_DOCKER_IMAGE`` (default: ``"{{ DOCKER_REGISTRY }}overhangio/openedx-credentials:{{ CREDENTIALS_VERSION }}"``)
- ``CREDENTIALS_EXTRA_PIP_REQUIREMENTS`` (default: ``[]``)
- ``CREDENTIALS_SITE_NAME`` (default: ``"LMS_HOST"``)
- ``CREDENTIALS_REPOSITORY`` (default: ``"https://github.com/openedx/credentials.git"``)
- ``CREDENTIALS_REPOSITORY_VERSION`` (default: ``"{{ OPENEDX_COMMON_VERSION }}"``)

Marketing & Theming
~~~~~~~~~~~~~~~~~~~

- ``CREDENTIALS_LOGO_TRADEMARK_URL`` (default: ``"https://edx-cdn.org/v3/default/logo-trademark.svg"``)
- ``CREDENTIALS_LOGO_TRADEMARK_URL_PNG`` (default: ``"https://edx-cdn.org/v3/default/logo-trademark.png"``)
- ``CREDENTIALS_LOGO_TRADEMARK_URL_SVG`` (default: ``"https://edx-cdn.org/v3/default/logo-trademark.svg"``)
- ``CREDENTIALS_LOGO_URL`` (default: ``"https://edx-cdn.org/v3/default/logo.svg"``)
- ``CREDENTIALS_LOGO_URL_PNG`` (default: ``"https://edx-cdn.org/v3/default/logo.png"``)
- ``CREDENTIALS_LOGO_URL_SVG`` (default: ``"https://edx-cdn.org/v3/default/logo.svg"``)
- ``CREDENTIALS_LOGO_WHITE_URL`` (default: ``"https://edx-cdn.org/v3/default/logo-white.svg"``)
- ``CREDENTIALS_LOGO_WHITE_URL_PNG`` (default: ``"https://edx-cdn.org/v3/default/logo-white.png"``)
- ``CREDENTIALS_LOGO_WHITE_URL_SVG`` (default: ``"https://edx-cdn.org/v3/default/logo-white.svg"``)
- ``CREDENTIALS_FAVICON_URL`` (default: ``"https://edx-cdn.org/v3/default/favicon.ico"``)
- ``CREDENTIALS_THEME_NAME`` (default: ``"edx-theme"``)

Backend authentication
~~~~~~~~~~~~~~~~~~~~~~~

- ``CREDENTIALS_BACKEND_SERVICE_EDX_OAUTH2_KEY`` (default: ``"credentials-backend-service-key"``)
- ``CREDENTIALS_BACKEND_SERVICE_EDX_OAUTH2_SECRET`` (default: ``"{{ CREDENTIALS_OAUTH2_SECRET }}"``)
- ``CREDENTIALS_BACKEND_SERVICE_EDX_OAUTH2_PROVIDER_URL`` (default: ``"http://lms:8000/oauth2"``)
- ``CREDENTIALS_OAUTH2_KEY`` (default: ``credentials-backend-service-key"``)
- ``CREDENTIALS_OAUTH2_SECRET`` (default: ``"CHANGE-ME"``)

Application Third party authentication
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- ``CREDENTIALS_SOCIAL_AUTH_REDIRECT_IS_HTTPS`` (default: ``{% if ENABLE_HTTPS %}True{% else %}False{% endif %}``)
- ``CREDENTIALS_SOCIAL_AUTH_EDX_OAUTH2_ISSUER`` (default: ``"{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}"``)
- ``CREDENTIALS_SOCIAL_AUTH_EDX_OAUTH2_URL_ROOT`` (default: ``"http://lms:8000"``)
- ``CREDENTIALS_SOCIAL_AUTH_EDX_OAUTH2_KEY`` (default: ``"credentials-sso-key"``)
- ``CREDENTIALS_SOCIAL_AUTH_EDX_OAUTH2_SECRET`` (default: ``"credentials-sso-secret"``)
- ``CREDENTIALS_SOCIAL_AUTH_EDX_OAUTH2_LOGOUT_URL`` (default: ``"{{ SOCIAL_AUTH_EDX_OAUTH2_ISSUER }}/logout"``)

Funding
-------
Expand Down
1 change: 1 addition & 0 deletions changelog.d/20231130_110806_regis_simplify.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- 💥[Improvement] Simplify plugin settings. As a consequence, many marketing settings are deprecated. If they were useful to you, you can override them using the "credentials-settings-common" patch. (by @regisb)
18 changes: 0 additions & 18 deletions tutorcredentials/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,18 @@
config: t.Dict[str, t.Dict[str, t.Any]] = {
"defaults": {
"VERSION": __version__,
"BACKEND_SERVICE_EDX_OAUTH2_PROVIDER_URL": "http://lms:8000/oauth2",
"BACKEND_SERVICE_EDX_OAUTH2_KEY": "{{ CREDENTIALS_OAUTH2_KEY }}",
"DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/openedx-credentials:{{ CREDENTIALS_VERSION }}",
"EXTRA_PIP_REQUIREMENTS": [],
"FAVICON_URL": "https://edx-cdn.org/v3/default/favicon.ico",
"HOST": "credentials.{{ LMS_HOST }}",
"LOGO_TRADEMARK_URL": "https://edx-cdn.org/v3/default/logo-trademark.svg",
"LOGO_TRADEMARK_URL_PNG": "https://edx-cdn.org/v3/default/logo-trademark.png",
"LOGO_TRADEMARK_URL_SVG": "https://edx-cdn.org/v3/default/logo-trademark.svg",
"LOGO_URL": "",
"LOGO_URL_PNG": "{{ CREDENTIALS_LOGO_URL }}",
"LOGO_URL_SVG": "",
"LOGO_WHITE_URL": "{{ CREDENTIALS_LOGO_URL }}",
"LOGO_WHITE_URL_PNG": "{{ CREDENTIALS_LOGO_URL }}",
"LOGO_WHITE_URL_SVG": "",
"MYSQL_DATABASE": "credentials",
"MYSQL_USERNAME": "credentials",
"OAUTH2_KEY": "credentials-key",
"OAUTH2_KEY_DEV": "credentials-key-dev",
"OAUTH2_KEY_SSO": "credentials-key-sso",
"OAUTH2_KEY_SSO_DEV": "credentials-key-sso-dev",
"PLATFORM_NAME": "{{ PLATFORM_NAME }}",
"SITE_NAME": "{{ LMS_HOST }}",
"SOCIAL_AUTH_REDIRECT_IS_HTTPS": False,
"SOCIAL_AUTH_EDX_OAUTH2_ISSUER": "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}",
"SOCIAL_AUTH_EDX_OAUTH2_URL_ROOT": "http://lms:8000",
"SOCIAL_AUTH_EDX_OAUTH2_KEY": "credentials-sso-key",
"SOCIAL_AUTH_EDX_OAUTH2_LOGOUT_URL": "{{ LMS_HOST }}/logout",
"THEME_NAME": "edx-theme",
"TOS_URL": "{{ LMS_HOST }}/tos",
"REPOSITORY": "https://github.com/openedx/credentials.git",
"REPOSITORY_VERSION": "{{ OPENEDX_COMMON_VERSION }}",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

{% include "credentials/apps/credentials/settings/partials/common.py" %}

SOCIAL_AUTH_EDX_OAUTH2_PUBLIC_URL_ROOT = "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}:8000"
SOCIAL_AUTH_EDX_OAUTH2_PUBLIC_URL_ROOT = "http://{{ LMS_HOST }}:8000"
FAVICON_URL = "http://{{ LMS_HOST }}:8000/favicon.ico"

BACKEND_SERVICE_EDX_OAUTH2_KEY = "{{ CREDENTIALS_OAUTH2_KEY }}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@
}
]

LOGO_TRADEMARK_URL = "https://edx-cdn.org/v3/default/logo-trademark.svg"
LOGO_TRADEMARK_URL_PNG = "https://edx-cdn.org/v3/default/logo-trademark.png"
LOGO_TRADEMARK_URL_SVG = "https://edx-cdn.org/v3/default/logo-trademark.svg"
LOGO_URL = "https://edx-cdn.org/v3/default/logo.svg"
LOGO_URL_PNG = "https://edx-cdn.org/v3/default/logo.png"
LOGO_URL_SVG = "https://edx-cdn.org/v3/default/logo.svg"
LOGO_WHITE_URL = "https://edx-cdn.org/v3/default/logo-white.svg"
LOGO_WHITE_URL_PNG = "https://edx-cdn.org/v3/default/logo-white.png"
LOGO_WHITE_URL_SVG = "https://edx-cdn.org/v3/default/logo-white.svg"
FAVICON_URL = "https://edx-cdn.org/v3/default/favicon.ico"
LOGO_URL = "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}/theming/asset/images/logo.png"
LOGO_TRADEMARK_URL = LOGO_URL
LOGO_TRADEMARK_URL_PNG = LOGO_URL
LOGO_TRADEMARK_URL_SVG = LOGO_URL
LOGO_URL_PNG = LOGO_URL
LOGO_URL_SVG = LOGO_URL
LOGO_WHITE_URL = LOGO_URL
LOGO_WHITE_URL_PNG = LOGO_URL
LOGO_WHITE_URL_SVG = LOGO_URL
FAVICON_URL = "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}/favicon.ico"

SOCIAL_AUTH_REDIRECT_IS_HTTPS = {% if ENABLE_HTTPS %}True{% else %}False{% endif %}
SOCIAL_AUTH_EDX_OAUTH2_ISSUER = "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}"
Expand Down
4 changes: 2 additions & 2 deletions tutorcredentials/templates/credentials/tasks/credentials/init
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ echo "credentials service - ./manage.py migrate create_or_update_site"
# for production
./manage.py create_or_update_site \
--site-domain "{{ CREDENTIALS_HOST }}" \
--site-name "{{ CREDENTIALS_SITE_NAME }}" \
--site-name "{{ LMS_HOST }}" \
--platform-name "{{ PLATFORM_NAME }}" \
--lms-url-root "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}{{ LMS_HOST }}" \
--catalog-api-url "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}{{ DISCOVERY_HOST }}/api/v1/" \
Expand All @@ -19,7 +19,7 @@ echo "credentials service - ./manage.py migrate create_or_update_site"
# for development
./manage.py create_or_update_site \
--site-domain "{{ CREDENTIALS_HOST }}" \
--site-name "{{ CREDENTIALS_SITE_NAME }}" \
--site-name "{{ LMS_HOST }}" \
--platform-name "{{ PLATFORM_NAME }}" \
--lms-url-root "http://{{ LMS_HOST }}:8000" \
--catalog-api-url "http://{{ DISCOVERY_HOST }}:8381/api/v1/" \
Expand Down

0 comments on commit a31f6b7

Please sign in to comment.