import os
from consts.landing_type import LandingType


DEBUG = os.environ.get('SERVER_SOFTWARE') is not None and os.getenv('APPLICATION_ID') != 's~tbatv-prod-hrd'
DEBUG = DEBUG or os.getenv('IS_TBA_TEST') is not None or os.getenv('TRAVIS') is not None

MAX_YEAR = 2018

# Fraction of requests to profile
RECORD_FRACTION = 0.1

# Fraction of requests to send to Google Analytics
GA_RECORD_FRACTION = 1.0

# The CONFIG variables should have exactly the same structure between environments
# Eventually a test environment should be added. -gregmarra 17 Jul 2012
if DEBUG:
    CONFIG = {
        "env": "dev",
        "memcache": False,
        "database_query_cache": False,
        "response_cache": False,
        "firebase-url": "https://thebluealliance-dev.firebaseio.com/{}.json?print=silent&auth={}",
        "firebase-push": False,
        "use-compiled-templates": False,
        "save-frc-api-response": False,
        "update-webcast-online-status": False,
    }
else:
    CONFIG = {
        "env": "prod",
        "memcache": True,
        "database_query_cache": True,
        "response_cache": True,
        "firebase-url": "https://tbatv-prod-hrd.firebaseio.com/{}.json?print=silent&auth={}",
        "firebase-push": True,
        "use-compiled-templates": True,
        "save-frc-api-response": True,
        "update-webcast-online-status": True,
    }

CONFIG["static_resource_version"] = 8

@@ -47,16 +47,51 @@
 ingType%0A
+from models.sitevar import Sitevar%0A
 %0A%0ADEBUG 
@@ -286,24 +286,8 @@
 ne%0A%0A
-MAX_YEAR = 2018%0A
 %0A# F
@@ -1418,8 +1418,319 @@
 n%22%5D = 8%0A
+%0A%0Adef _get_max_year():%0A    DEFAULT_YEAR = 2018%0A    try:%0A        status_sitevar = Sitevar.get_by_id('apistatus')%0A        return status_sitevar.contents.get(%0A            'max_season', DEFAULT_YEAR) if status_sitevar else DEFAULT_YEAR%0A    except Exception:%0A        return DEFAULT_YEAR%0A%0A%0AMAX_YEAR = _get_max_year()%0A

Read MAX_YEAR from apistatus sitevar (#2299)