from __future__ import print_function import os import sys import subprocess import htpasswd sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../config')) from config_json import get_config_json NGINX_CONFIG_PATH = '/etc/nginx/sites-available/dockyard' HTPASSWD_PATH = '/etc/nginx/registry.htpasswd' https_domain = get_config_json('HTTPS_DOMAIN') ssl_crt_file = get_config_json('SSL_CRT_FILE', return_path = True) ssl_key_file = get_config_json('SSL_KEY_FILE', return_path = True) http_auth_user = get_config_json('HTTP_AUTH_USER') http_auth_password = get_config_json('HTTP_AUTH_PASSWORD') read_only_registry = get_config_json('READ_ONLY') def parse_config_template(config_template_path, config_variables, config_output_path): with open(config_template_path, 'r') as config_file: nginx_config = config_file.read() for k, v in config_variables.iteritems(): nginx_config = nginx_config.replace(k, v) with open(config_output_path, 'w') as config_file: config_file.write(nginx_config)
from __future__ import print_function import os import sys import subprocess import htpasswd sys.path.append( os.path.join(os.path.dirname(os.path.realpath(__file__)), '../config')) from config_json import get_config_json NGINX_CONFIG_PATH = '/etc/nginx/sites-available/dockyard' HTPASSWD_PATH = '/etc/nginx/registry.htpasswd' https_domain = get_config_json('HTTPS_DOMAIN') ssl_crt_file = get_config_json('SSL_CRT_FILE', return_path=True) ssl_key_file = get_config_json('SSL_KEY_FILE', return_path=True) http_auth_user = get_config_json('HTTP_AUTH_USER') http_auth_password = get_config_json('HTTP_AUTH_PASSWORD') read_only_registry = get_config_json('READ_ONLY') def parse_config_template(config_template_path, config_variables, config_output_path): with open(config_template_path, 'r') as config_file: nginx_config = config_file.read() for k, v in config_variables.iteritems(): nginx_config = nginx_config.replace(k, v) with open(config_output_path, 'w') as config_file:
import os import sys import subprocess sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../config')) from config_json import get_config_json environment = dict(os.environ) environment['DOCKER_REGISTRY_CONFIG'] = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'registry-config.yml') https_domain = get_config_json('HTTPS_DOMAIN') read_only_registry = get_config_json('READ_ONLY') if not https_domain and not read_only_registry: environment['REGISTRY_PORT'] = '80' repository_path = get_config_json('REPOSITORY_PATH') if repository_path and repository_path.startswith('s3:///'): environment['SETTINGS_FLAVOR'] = 's3' s3_path = repository_path[6:] s3_bucket, s3_directory = s3_path.split('/', 1) environment['AWS_S3_BUCKET'] = s3_bucket if s3_directory: environment['STORAGE_PATH'] = s3_directory for key in ('AWS_ACCESS_KEY', 'AWS_ACCESS_SECRET', 'S3_ENCRYPT', 'S3_USE_HTTPS'): value = get_config_json(key) if value: environment[key] = value