示例#1
0
文件: app.py 项目: tylerauerbeck/quay
        )

    if (
        v3_upgrade_mode != "background"
        and v3_upgrade_mode != "complete"
        and v3_upgrade_mode != "production-transition"
        and v3_upgrade_mode != "post-oci-rollout"
        and v3_upgrade_mode != "post-oci-roll-back-compat"
    ):
        raise Exception("Invalid value for config `V3_UPGRADE_MODE`. Please check the upgrade docs")

# Split the registry model based on config.
# TODO: Remove once we are fully on the OCI data model.
registry_model.setup_split(
    app.config.get("OCI_NAMESPACE_PROPORTION") or 0,
    app.config.get("OCI_NAMESPACE_WHITELIST") or set(),
    app.config.get("V22_NAMESPACE_WHITELIST") or set(),
    app.config.get("V3_UPGRADE_MODE"),
)

# Allow user to define a custom storage preference for the local instance.
_distributed_storage_preference = os.environ.get("QUAY_DISTRIBUTED_STORAGE_PREFERENCE", "").split()
if _distributed_storage_preference:
    app.config["DISTRIBUTED_STORAGE_PREFERENCE"] = _distributed_storage_preference

# Generate a secret key if none was specified.
if app.config["SECRET_KEY"] is None:
    logger.debug("Generating in-memory secret key")
    app.config["SECRET_KEY"] = generate_secret_key()

# If the "preferred" scheme is https, then http is not allowed. Therefore, ensure we have a secure
# session cookie.
示例#2
0
文件: app.py 项目: xzwupeng/quay
            'Configuration flag `V3_UPGRADE_MODE` must be set. Please check the upgrade docs'
        )

    if (v3_upgrade_mode != 'background' and v3_upgrade_mode != 'complete'
            and v3_upgrade_mode != 'production-transition'
            and v3_upgrade_mode != 'post-oci-rollout'
            and v3_upgrade_mode != 'post-oci-roll-back-compat'):
        raise Exception(
            'Invalid value for config `V3_UPGRADE_MODE`. Please check the upgrade docs'
        )

# Split the registry model based on config.
# TODO: Remove once we are fully on the OCI data model.
registry_model.setup_split(
    app.config.get('OCI_NAMESPACE_PROPORTION') or 0,
    app.config.get('OCI_NAMESPACE_WHITELIST') or set(),
    app.config.get('V22_NAMESPACE_WHITELIST') or set(),
    app.config.get('V3_UPGRADE_MODE'))

# Allow user to define a custom storage preference for the local instance.
_distributed_storage_preference = os.environ.get(
    'QUAY_DISTRIBUTED_STORAGE_PREFERENCE', '').split()
if _distributed_storage_preference:
    app.config[
        'DISTRIBUTED_STORAGE_PREFERENCE'] = _distributed_storage_preference

# Generate a secret key if none was specified.
if app.config['SECRET_KEY'] is None:
    logger.debug('Generating in-memory secret key')
    app.config['SECRET_KEY'] = generate_secret_key()