Added OAuth options to the config

This commit is contained in:
Taizo 'Tsa6' Simpson 2017-09-21 18:01:35 -04:00
parent bdbab9b6ad
commit 8e8fb8e53f
2 changed files with 18 additions and 0 deletions

View File

@ -14,10 +14,12 @@ import dj_database_url
import os import os
import configparser import configparser
import warnings import warnings
import base64
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read('options.ini') config.read('options.ini')
options = config['General'] options = config['General']
oauth_options = config['OAuth']
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@ -128,3 +130,8 @@ USE_TZ = True
# https://docs.djangoproject.com/en/1.11/howto/static-files/ # https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_URL = '/static/' STATIC_URL = '/static/'
AUTH_TOKEN_ENDPOINT = oauth_options.get('token_endpoint','https://icynet.eu/oauth/')
AUTH_B64 = base64.b64encode(bytearray('%s:%s'%(oauth_options.get('client_id'),oauth_options.get('client_secret')),'utf-8'))
AUTH_REDIRECT_URL = oauth_options.get('redirect_url')

View File

@ -9,3 +9,14 @@ secret_key=5up3r s3cr3t k3y
#For configuration details #For configuration details
database=sqlite:///database.sqlite3 database=sqlite:///database.sqlite3
[OAuth]
#The root of the oauth endpoint you are using for oauth settings
token_endpoint=https://icynet.eu/oauth/
#The client id, client secret, and redirect url used in the confguration
#of your oauth client on the site that you plan to use for oauth.
#The redirect url should probably point to the appropriate view, and
#needs to be fully qualified.
client_id=CLIENT ID HERE
client_secret=CLIENT SECRET HERE
redirect_url=REDIRECT URL HERE