From 78d6c9d9a38d86bf1a04c170c059df195401b8f8 Mon Sep 17 00:00:00 2001 From: yackob03 Date: Tue, 29 Oct 2013 16:11:54 -0400 Subject: [PATCH] Just use the current server as the registry server, this will work for all externally available addresses. --- config.py | 3 --- endpoints/index.py | 5 ++++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config.py b/config.py index 3647c886e..de81bdfe6 100644 --- a/config.py +++ b/config.py @@ -103,7 +103,6 @@ class BuildNodeConfig(object): class DebugConfig(FlaskConfig, MailConfig, LocalStorage, SQLiteDB, StripeTestConfig, MixpanelTestConfig, GitHubTestConfig, DigitalOceanConfig, AWSCredentials, BuildNodeConfig): - REGISTRY_SERVER = 'localhost:5000' LOGGING_CONFIG = { 'level': logging.DEBUG, 'format': LOG_FORMAT @@ -117,7 +116,6 @@ class LocalHostedConfig(FlaskConfig, MailConfig, S3Storage, RDSMySQL, StripeLiveConfig, MixpanelTestConfig, GitHubProdConfig, DigitalOceanConfig, BuildNodeConfig): - REGISTRY_SERVER = 'localhost:5000' LOGGING_CONFIG = { 'level': logging.DEBUG, 'format': LOG_FORMAT @@ -128,7 +126,6 @@ class LocalHostedConfig(FlaskConfig, MailConfig, S3Storage, RDSMySQL, class ProductionConfig(FlaskConfig, MailConfig, S3Storage, RDSMySQL, StripeLiveConfig, MixpanelProdConfig, GitHubProdConfig, DigitalOceanConfig, BuildNodeConfig): - REGISTRY_SERVER = 'quay.io' LOGGING_CONFIG = { 'stream': sys.stderr, 'level': logging.DEBUG, diff --git a/endpoints/index.py b/endpoints/index.py index 375fa94b4..4920e2b15 100644 --- a/endpoints/index.py +++ b/endpoints/index.py @@ -2,6 +2,7 @@ import json import urllib import json import logging +import urlparse from flask import request, make_response, jsonify, abort from functools import wraps @@ -25,7 +26,9 @@ def generate_headers(role='read'): def wrapper(namespace, repository, *args, **kwargs): response = f(namespace, repository, *args, **kwargs) - response.headers['X-Docker-Endpoints'] = app.config['REGISTRY_SERVER'] + # We run our index and registry on the same hosts for now + registry_server = urlparse.urlparse(request.url).netloc + response.headers['X-Docker-Endpoints'] = registry_server has_token_request = request.headers.get('X-Docker-Token', '')