Merge branch 'master' of https://bitbucket.org/yackob03/quay
This commit is contained in:
commit
b1ec63893d
3 changed files with 22 additions and 8 deletions
14
app.py
14
app.py
|
@ -5,13 +5,19 @@ from flask import Flask
|
|||
from flask.ext.principal import Principal
|
||||
from flask.ext.login import LoginManager
|
||||
from flask.ext.mail import Mail
|
||||
from config import ProductionConfig, DebugConfig
|
||||
from config import ProductionConfig, DebugConfig, LocalHostedConfig
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
is_prod = os.environ.get('STACK', '').strip().lower().startswith('prod')
|
||||
config_object = ProductionConfig() if is_prod else DebugConfig()
|
||||
app.config.from_object(config_object)
|
||||
stack = os.environ.get('STACK', '').strip().lower()
|
||||
if stack.startswith('prod'):
|
||||
config = ProductionConfig()
|
||||
elif stack.startswith('localhosted'):
|
||||
config = LocalHostedConfig()
|
||||
else:
|
||||
config = DebugConfig()
|
||||
|
||||
app.config.from_object(config)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -62,6 +62,14 @@ class DebugConfig(FlaskConfig, MailConfig, LocalStorage, SQLiteDB):
|
|||
}
|
||||
|
||||
|
||||
class LocalHostedConfig(FlaskConfig, MailConfig, S3Storage, RDSMySQL):
|
||||
REGISTRY_SERVER = 'localhost:5000'
|
||||
LOGGING_CONFIG = {
|
||||
'level': logging.DEBUG,
|
||||
'format': LOG_FORMAT
|
||||
}
|
||||
|
||||
|
||||
class ProductionConfig(FlaskConfig, MailConfig, S3Storage, RDSMySQL):
|
||||
REGISTRY_SERVER = 'quay.io'
|
||||
LOGGING_CONFIG = {
|
||||
|
|
|
@ -27,7 +27,7 @@ def get_tags(namespace, repository):
|
|||
|
||||
if permission.can() or model.repository_is_public(namespace, repository):
|
||||
tags = model.list_repository_tags(namespace, repository)
|
||||
tag_map = {tag.name: tag.image.image_id for tag in tags}
|
||||
tag_map = {tag.name: tag.image.docker_image_id for tag in tags}
|
||||
return jsonify(tag_map)
|
||||
|
||||
abort(403)
|
||||
|
@ -42,7 +42,7 @@ def get_tag(namespace, repository, tag):
|
|||
|
||||
if permission.can() or model.repository_is_public(namespace, repository):
|
||||
tag_image = model.get_tag_image(namespace, repository, tag)
|
||||
response = make_response(tag_image.image_id, 200)
|
||||
response = make_response(tag_image.docker_image_id, 200)
|
||||
|
||||
abort(403)
|
||||
|
||||
|
@ -55,8 +55,8 @@ def put_tag(namespace, repository, tag):
|
|||
permission = ModifyRepositoryPermission(namespace, repository)
|
||||
|
||||
if permission.can():
|
||||
image_id = json.loads(request.data)
|
||||
model.create_or_update_tag(namespace, repository, tag, image_id)
|
||||
docker_image_id = json.loads(request.data)
|
||||
model.create_or_update_tag(namespace, repository, tag, docker_image_id)
|
||||
|
||||
return make_response('Created', 200)
|
||||
|
||||
|
|
Reference in a new issue