зеркало из https://github.com/mozilla/subhub.git
Stripe API request deadline enablement
This commit is contained in:
Родитель
a84d9d71ce
Коммит
48d33cf13e
|
@ -60,24 +60,25 @@ services:
|
|||
environment:
|
||||
AWS_ACCESS_KEY_ID: "fake-id"
|
||||
AWS_SECRET_ACCESS_KEY: "fake-key"
|
||||
STRIPE_API_KEY: $STRIPE_API_KEY
|
||||
STRIPE_MOCK_PORT: $STRIPE_MOCK_PORT
|
||||
HUB_API_KEY: $HUB_API_KEY
|
||||
BRANCH: $BRANCH
|
||||
DELETED_USER_TABLE: $DELETED_USER_TABLE
|
||||
DEPLOYED_BY: $DEPLOYED_BY
|
||||
DEPLOYED_ENV: $DEPLOYED_ENV
|
||||
DEPLOYED_WHEN: $DEPLOYED_WHEN
|
||||
PROJECT_NAME: $PROJECT_NAME
|
||||
BRANCH: $BRANCH
|
||||
VERSION: $VERSION
|
||||
REVISION: $REVISION
|
||||
LOG_LEVEL: $LOG_LEVEL
|
||||
REMOTE_ORIGIN_URL: $REMOTE_ORIGIN_URL
|
||||
PROFILING_ENABLED: $PROFILING_ENABLED
|
||||
PROCESS_EVENTS_HOURS: 6
|
||||
USER_TABLE: $USER_TABLE
|
||||
DELETED_USER_TABLE: $DELETED_USER_TABLE
|
||||
EVENT_TABLE: $EVENT_TABLE
|
||||
LOCAL_HUB_FLASK_PORT: $LOCAL_HUB_FLASK_PORT
|
||||
LOG_LEVEL: $LOG_LEVEL
|
||||
HUB_API_KEY: $HUB_API_KEY
|
||||
PROCESS_EVENTS_HOURS: 6
|
||||
PROFILING_ENABLED: $PROFILING_ENABLED
|
||||
PROJECT_NAME: $PROJECT_NAME
|
||||
REMOTE_ORIGIN_URL: $REMOTE_ORIGIN_URL
|
||||
STRIPE_API_KEY: $STRIPE_API_KEY
|
||||
STRIPE_MOCK_PORT: $STRIPE_MOCK_PORT
|
||||
STRIPE_REQUEST_TIMEOUT: $STRIPE_REQUEST_TIMEOUT
|
||||
USER_TABLE: $USER_TABLE
|
||||
VERSION: $VERSION
|
||||
REVISION: $REVISION
|
||||
ports:
|
||||
- "5001:5001"
|
||||
depends_on:
|
||||
|
|
1
dodo.py
1
dodo.py
|
@ -74,6 +74,7 @@ def envs(sep=" ", **kwargs):
|
|||
REVISION=CFG.REVISION,
|
||||
STRIPE_API_KEY=CFG.STRIPE_API_KEY,
|
||||
STRIPE_LOCAL=CFG.STRIPE_LOCAL,
|
||||
STRIPE_REQUEST_TIMEOUT=CFG.STRIPE_REQUEST_TIMEOUT,
|
||||
STRIPE_MOCK_HOST=CFG.STRIPE_MOCK_HOST,
|
||||
STRIPE_MOCK_PORT=CFG.STRIPE_MOCK_PORT,
|
||||
SUPPORT_API_KEY=CFG.SUPPORT_API_KEY,
|
||||
|
|
|
@ -18,3 +18,4 @@ default:
|
|||
USER_TABLE: ${env:USER_TABLE}
|
||||
DELETED_USER_TABLE: ${env:DELETED_USER_TABLE}
|
||||
EVENT_TABLE: ${env:EVENT_TABLE}
|
||||
STRIPE_REQUEST_TIMEOUT: ${env:STRIPE_REQUEST_TIMEOUT}
|
||||
|
|
|
@ -7,6 +7,7 @@ ARG AWS_SECRET_ACCESS_KEY
|
|||
ARG LOCAL_HUB_FLASK_PORT
|
||||
ARG SUPPORT_API_KEY
|
||||
ARG DYNALITE_PORT
|
||||
ARG STRIPE_REQUEST_TIMEOUT
|
||||
|
||||
ENV STRIPE_API_KEY=$STRIPE_API_KEY \
|
||||
AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
|
||||
|
@ -17,7 +18,8 @@ ENV STRIPE_API_KEY=$STRIPE_API_KEY \
|
|||
USER_TABLE=$USER_TABLE \
|
||||
DELETED_USER_TABLE=$DELETED_USER_TABLE \
|
||||
EVENT_TABLE=$EVENT_TABLE \
|
||||
FLASK_ENV=development
|
||||
FLASK_ENV=development \
|
||||
STRIPE_REQUEST_TIMEOUT=$STRIPE_REQUEST_TIMEOUT
|
||||
|
||||
EXPOSE $LOCAL_FLASK_PORT
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import stripe
|
|||
from flask import current_app, g, jsonify
|
||||
from flask_cors import CORS
|
||||
from flask import request
|
||||
from typing import Any
|
||||
|
||||
from shared import secrets
|
||||
from shared.exceptions import SubHubError
|
||||
|
@ -75,8 +76,8 @@ if is_docker():
|
|||
logger.info("Stripe API URL", url=stripe.api_base, local=CFG.STRIPE_LOCAL)
|
||||
|
||||
|
||||
def create_app(config=None):
|
||||
# configure_logger()
|
||||
def create_app(config=None) -> Any:
|
||||
stripe.timeout = CFG.STRIPE_REQUEST_TIMEOUT
|
||||
logger.info("creating flask app", config=config)
|
||||
region = "localhost"
|
||||
host = f"http://dynamodb:{CFG.DYNALITE_PORT}" if is_docker() else CFG.DYNALITE_URL
|
||||
|
|
|
@ -183,6 +183,10 @@ class AutoConfigPlus(AutoConfig): # pylint: disable=too-many-public-methods
|
|||
def EVENT_TABLE(self):
|
||||
return self("EVENT_TABLE", f"events-{CFG.DEPLOYED_ENV}")
|
||||
|
||||
@property
|
||||
def STRIPE_REQUEST_TIMEOUT(self):
|
||||
return self("STRIPE_REQUEST_TIMEOUT", 9, cast=int)
|
||||
|
||||
@property
|
||||
def STRIPE_MOCK_HOST(self):
|
||||
return self("STRIPE_MOCK_HOST", "stripe")
|
||||
|
|
|
@ -181,7 +181,7 @@ class SubHubDeletedAccountModel(Model):
|
|||
cust_id = UnicodeAttribute(range_key=True)
|
||||
origin_system = UnicodeAttribute()
|
||||
customer_status = UnicodeAttribute()
|
||||
subscription_info = ListAttribute()
|
||||
subscription_info = ListAttribute() # type: ignore
|
||||
|
||||
|
||||
def _create_deleted_account_model(table_name_, region_, host_) -> Any:
|
||||
|
@ -205,7 +205,7 @@ def _create_deleted_account_model(table_name_, region_, host_) -> Any:
|
|||
cust_id = UnicodeAttribute(range_key=True)
|
||||
origin_system = UnicodeAttribute()
|
||||
customer_status = UnicodeAttribute()
|
||||
subscription_info = ListAttribute(default=list)
|
||||
subscription_info = ListAttribute(default=list) # type: ignore
|
||||
cust_index = CustomerIndex()
|
||||
|
||||
return SubHubDeletedAccountModel
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
import logging.config
|
||||
|
||||
from shared.cfg import CFG
|
||||
from typing import Any
|
||||
|
||||
LOGGER = None
|
||||
|
||||
|
@ -46,7 +47,7 @@ def event_uppercase(logger, method_name, event_dict):
|
|||
return event_dict
|
||||
|
||||
|
||||
def get_logger():
|
||||
def get_logger() -> Any:
|
||||
global LOGGER
|
||||
if not LOGGER:
|
||||
from structlog import configure, processors, stdlib, threadlocal, get_logger
|
||||
|
|
Загрузка…
Ссылка в новой задаче