mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-10 10:03:38 -04:00
Merge branch 'master' into add-crown-column-to-services
This commit is contained in:
@@ -417,7 +417,7 @@ class Live(Config):
|
||||
FUNCTIONAL_TEST_PROVIDER_SMS_TEMPLATE_ID = 'ba9e1789-a804-40b8-871f-cc60d4c1286f'
|
||||
PERFORMANCE_PLATFORM_ENABLED = True
|
||||
API_RATE_LIMIT_ENABLED = True
|
||||
CHECK_PROXY_HEADER = False
|
||||
CHECK_PROXY_HEADER = True
|
||||
|
||||
|
||||
class CloudFoundryConfig(Config):
|
||||
|
||||
@@ -1485,17 +1485,12 @@ class LetterRate(db.Model):
|
||||
__tablename__ = 'letter_rates'
|
||||
|
||||
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
valid_from = valid_from = db.Column(db.DateTime, nullable=False)
|
||||
|
||||
|
||||
class LetterRateDetail(db.Model):
|
||||
__tablename__ = 'letter_rate_details'
|
||||
|
||||
id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
letter_rate_id = db.Column(UUID(as_uuid=True), db.ForeignKey('letter_rates.id'), index=True, nullable=False)
|
||||
letter_rate = db.relationship('LetterRate', backref='letter_rates')
|
||||
page_total = db.Column(db.Integer, nullable=False)
|
||||
start_date = db.Column(db.DateTime, nullable=False)
|
||||
end_date = db.Column(db.DateTime, nullable=True)
|
||||
sheet_total = db.Column(db.Integer, nullable=False) # double sided sheet
|
||||
rate = db.Column(db.Numeric(), nullable=False)
|
||||
crown = db.Column(db.Boolean, nullable=False)
|
||||
post_class = db.Column(db.String, nullable=False)
|
||||
|
||||
|
||||
class MonthlyBilling(db.Model):
|
||||
|
||||
@@ -23,7 +23,7 @@ from app.dao.service_email_reply_to_dao import dao_get_reply_to_by_id
|
||||
|
||||
|
||||
def check_service_over_api_rate_limit(service, api_key):
|
||||
if current_app.config['API_RATE_LIMIT_ENABLED']:
|
||||
if current_app.config['API_RATE_LIMIT_ENABLED'] and current_app.config['REDIS_ENABLED']:
|
||||
cache_key = rate_limit_cache_key(service.id, api_key.key_type)
|
||||
rate_limit = current_app.config['API_KEY_LIMITS'][api_key.key_type]['limit']
|
||||
interval = current_app.config['API_KEY_LIMITS'][api_key.key_type]['interval']
|
||||
@@ -33,7 +33,7 @@ def check_service_over_api_rate_limit(service, api_key):
|
||||
|
||||
|
||||
def check_service_over_daily_message_limit(key_type, service):
|
||||
if key_type != KEY_TYPE_TEST:
|
||||
if key_type != KEY_TYPE_TEST and current_app.config['REDIS_ENABLED']:
|
||||
cache_key = daily_limit_cache_key(service.id)
|
||||
service_stats = redis_store.get(cache_key)
|
||||
if not service_stats:
|
||||
|
||||
Reference in New Issue
Block a user