forked from openedx/credentials
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from edly-io/farhan/EDLY-5506
Add command for automating local setup of Edly Multisite Devstack
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
credentials/apps/core/management/commands/setup_credentials_service.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
""" Management command to set up credentials service locally""" | ||
from django.core.management.base import BaseCommand | ||
from django.contrib.sites.models import Site | ||
from credentials.apps.core.models import SiteConfiguration | ||
|
||
|
||
class Command(BaseCommand): | ||
help = 'Set up credentials service locally.' | ||
domain_name = 'edx.devstack.lms:18150' | ||
|
||
def setup_credentials_service(self): | ||
site, _ = Site.objects.get_or_create(name=self.domain_name, domain=self.domain_name) | ||
SiteConfiguration.objects.get_or_create( | ||
site=site, | ||
edx_org_short_name='edly', | ||
platform_name='Edly', | ||
company_name='Edly', | ||
lms_url_root='http://edx.devstack.lms:18000/', | ||
catalog_api_url='http://edx.devstack.lms:18381/api/v1/', | ||
tos_url='http://edx.devstack.lms:18000/tos', | ||
privacy_policy_url='http://edx.devstack.lms:18000/privacy-policy', | ||
homepage_url='http://edx.devstack.lms:18000/', | ||
certificate_help_url='http://edx.devstack.lms:18000/', | ||
|
||
edly_client_branding_and_django_settings= | ||
{ | ||
"DJANGO_SETTINGS_OVERRIDE": { | ||
"SOCIAL_AUTH_EDX_OAUTH2_KEY": "credentials-sso-key", | ||
"SOCIAL_AUTH_EDX_OAUTH2_SECRET": "credentials-sso-secret", | ||
"SOCIAL_AUTH_EDX_OAUTH2_ISSUER": "http://edx.devstack.lms:18000", | ||
"SOCIAL_AUTH_EDX_OAUTH2_URL_ROOT": "http://edx.devstack.lms:18000", | ||
"SOCIAL_AUTH_EDX_OAUTH2_PUBLIC_URL_ROOT": "http://edx.devstack.lms:18000", | ||
"SOCIAL_AUTH_EDX_OAUTH2_LOGOUT_URL": "http://edx.devstack.lms:18000/logout", | ||
"BACKEND_SERVICE_EDX_OAUTH2_KEY": "credentials-backend-service-key", | ||
"BACKEND_SERVICE_EDX_OAUTH2_SECRET": "credentials-backend-service-secret", | ||
"BACKEND_SERVICE_EDX_OAUTH2_PROVIDER_URL": "http://edx.devstack.lms:18000" | ||
} | ||
} | ||
) | ||
|
||
def handle(self, *args, **options): | ||
"""Set up credentials service locally.""" | ||
self.setup_credentials_service() |