changed to use new library config code and changed internal endpoint naming

pull/39/head
Chris Veilleux 2019-01-30 23:17:59 -06:00
parent 5b2d65d546
commit 1b4574a367
1 changed files with 16 additions and 6 deletions

View File

@ -1,22 +1,27 @@
import os
from flask import Flask, request
from flask_restful import Api
from selene.api.base_config import get_base_config
from .endpoints import (
AuthenticateAntisocialEndpoint,
AuthenticateInternalEndpoint,
SocialLoginTokensEndpoint,
AuthorizeFacebookEndpoint,
AuthorizeGithubEndpoint,
AuthorizeGoogleEndpoint,
LogoutEndpoint
)
from .config import get_config_location
# Initialize the Flask application and the Flask Restful API
sso = Flask(__name__)
sso.config.from_object(get_config_location())
sso_api = Api(sso, catch_all_404s=True)
sso.config.from_object(get_base_config())
sso.config['SSO_BASE_URL'] = os.environ['SSO_BASE_URL']
# Define the endpoints
sso_api.add_resource(AuthenticateAntisocialEndpoint, '/api/antisocial')
# Initialize the REST API and define the endpoints
sso_api = Api(sso, catch_all_404s=True)
sso_api.add_resource(AuthenticateInternalEndpoint, '/api/antisocial')
sso_api.add_resource(AuthorizeFacebookEndpoint, '/api/social/facebook')
sso_api.add_resource(AuthorizeGithubEndpoint, '/api/social/github')
sso_api.add_resource(AuthorizeGoogleEndpoint, '/api/social/google')
@ -39,3 +44,8 @@ def add_cors_headers(response):
sso.after_request(add_cors_headers)
@sso.teardown_appcontext
def close_db_connections():
sso.config['DB_CONNECTION_POOL'].close_all()