diff options
-rw-r--r-- | pysite/constants.py | 4 | ||||
-rw-r--r-- | pysite/route_manager.py | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/pysite/constants.py b/pysite/constants.py index 03b660d6..3ccebf18 100644 --- a/pysite/constants.py +++ b/pysite/constants.py @@ -27,12 +27,14 @@ SERVER_ID = 267624335836053506 DISCORD_API_ENDPOINT = "https://discordapp.com/api" DISCORD_OAUTH_REDIRECT = "/auth/discord" -DISCORD_OAUTH_AUTHORIZED = environ.get("DISCORD_OAUTH_AUTHORIZED", "https://pythondiscord.com/auth/discord/authorized") +DISCORD_OAUTH_AUTHORIZED = "/auth/discord/authorized" DISCORD_OAUTH_ID = environ.get('DISCORD_OAUTH_ID', '') DISCORD_OAUTH_SECRET = environ.get('DISCORD_OAUTH_SECRET', '') DISCORD_OAUTH_SCOPE = 'identify email guilds.join' OAUTH_DATABASE = "oauth_data" +PREFERRED_URL_SCHEME = environ.get("PREFERRED_URL_SCHEME", "https") # Change this in testing to "http" + ERROR_DESCRIPTIONS = { # 5XX 500: "The server encountered an unexpected error ._.", diff --git a/pysite/route_manager.py b/pysite/route_manager.py index 9ecd3ced..14ae22db 100644 --- a/pysite/route_manager.py +++ b/pysite/route_manager.py @@ -10,8 +10,8 @@ from flask_sockets import Sockets from pysite.base_route import APIView, BaseView, ErrorView, RouteView from pysite.constants import ( - DISCORD_OAUTH_ID, DISCORD_OAUTH_SCOPE, DISCORD_OAUTH_SECRET, DISCORD_OAUTH_REDIRECT, DISCORD_OAUTH_AUTHORIZED -) + DISCORD_OAUTH_ID, DISCORD_OAUTH_SCOPE, DISCORD_OAUTH_SECRET, DISCORD_OAUTH_REDIRECT, DISCORD_OAUTH_AUTHORIZED, + PREFERRED_URL_SCHEME) from pysite.database import RethinkDB from pysite.oauth import OauthBackend from pysite.websockets import WS @@ -33,6 +33,7 @@ class RouteManager: self.log = logging.getLogger() self.app.secret_key = os.environ.get("WEBPAGE_SECRET_KEY", "super_secret") self.app.config["SERVER_NAME"] = os.environ.get("SERVER_NAME", "pythondiscord.local:8080") + self.app.config["PREFERRED_URL_SCHEME"] = PREFERRED_URL_SCHEME self.app.before_request(self.db.before_request) self.app.teardown_request(self.db.teardown_request) |