From 2ea59c8555206c6bbb0aa5141ee8240303639056 Mon Sep 17 00:00:00 2001 From: jakedt Date: Tue, 4 Mar 2014 19:40:29 -0500 Subject: [PATCH] Allow for special config for staging. --- app.py | 3 +++ config.py | 19 ++++++++++++++++++- static/js/app.js | 4 ++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 3870e9b93..f193dafc1 100644 --- a/app.py +++ b/app.py @@ -20,6 +20,9 @@ stack = os.environ.get('STACK', '').strip().lower() if stack.startswith('prod'): logger.info('Running with production config.') config = ProductionConfig() +elif stack.startswith('staging'): + logger.info('Running with staging config on production data.') + config = StagingConfig() elif stack.startswith('localhosted'): logger.info('Running with debug config on production data.') config = LocalHostedConfig() diff --git a/config.py b/config.py index 22870bbe9..0b07d2689 100644 --- a/config.py +++ b/config.py @@ -156,6 +156,11 @@ class GitHubTestConfig(object): GITHUB_USER_EMAILS = GITHUB_USER_URL + '/emails' +class GitHubStagingConfig(GitHubTestConfig): + GITHUB_CLIENT_ID = '4886304accbc444f0471' + GITHUB_CLIENT_SECRET = '27d8a5d99af02dda821eb10883bcb2e785e70a62' + + class GitHubProdConfig(GitHubTestConfig): GITHUB_CLIENT_ID = '5a8c08b06c48d89d4d1e' GITHUB_CLIENT_SECRET = 'f89d8bb28ea3bd4e1c68808500d185a816be53b1' @@ -226,12 +231,24 @@ class LocalHostedConfig(FlaskConfig, MailConfig, S3Storage, RDSMySQL, GitHubProdConfig, DigitalOceanConfig, BuildNodeConfig, S3Userfiles, RedisBuildLogs, UserEventConfig, LargePoolHttpClient): - LOGGING_CONFIG = logs_init_builder() + LOGGING_CONFIG = logs_init_builder(formatter=logging.Formatter()) SEND_FILE_MAX_AGE_DEFAULT = 0 URL_SCHEME = 'http' URL_HOST = 'ci.devtable.com:5000' +class StagingConfig(FlaskProdConfig, MailConfig, S3Storage, RDSMySQL, + StripeLiveConfig, MixpanelProdConfig, + GitHubStagingConfig, DigitalOceanConfig, BuildNodeConfig, + S3Userfiles, RedisBuildLogs, UserEventConfig, + LargePoolHttpClient): + + LOGGING_CONFIG = logs_init_builder(formatter=logging.Formatter()) + SEND_FILE_MAX_AGE_DEFAULT = 0 + URL_SCHEME = 'https' + URL_HOST = 'staging.quay.io' + + class ProductionConfig(FlaskProdConfig, MailConfig, S3Storage, RDSMySQL, StripeLiveConfig, MixpanelProdConfig, GitHubProdConfig, DigitalOceanConfig, BuildNodeConfig, diff --git a/static/js/app.js b/static/js/app.js index d82f9f185..affa12fdb 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -445,6 +445,10 @@ quayApp = angular.module('quay', ['ngRoute', 'chieffancypants.loadingBar', 'angu keyService['stripePublishableKey'] = 'pk_live_P5wLU0vGdHnZGyKnXlFG4oiu'; keyService['githubClientId'] = '5a8c08b06c48d89d4d1e'; keyService['githubRedirectUri'] = 'https://quay.io/oauth2/github/callback'; + } else if($location.host() === 'staging.quay.io') { + keyService['stripePublishableKey'] = 'pk_live_P5wLU0vGdHnZGyKnXlFG4oiu'; + keyService['githubClientId'] = '4886304accbc444f0471'; + keyService['githubRedirectUri'] = 'https://staging.quay.io/oauth2/github/callback'; } else { keyService['stripePublishableKey'] = 'pk_test_uEDHANKm9CHCvVa2DLcipGRh'; keyService['githubClientId'] = 'cfbc4aca88e5c1b40679';