diff --git a/conf/init/nginx_conf_create.sh b/conf/init/nginx_conf_create.sh index 81b564e69..d3ffa002e 100755 --- a/conf/init/nginx_conf_create.sh +++ b/conf/init/nginx_conf_create.sh @@ -6,21 +6,22 @@ import yaml import jinja2 +def write_config(filename, **kwargs): + with open(filename + ".jnj") as f: + template = jinja2.Template(f.read()) + rendered = template.render(kwargs) + + with open(filename, 'w') as f: + f.write(rendered) + def generate_nginx_config(): """ Generates nginx config from the app config """ use_https = os.path.exists('conf/stack/ssl.key') - - with open("conf/nginx/nginx.conf.jnj") as f: - template = jinja2.Template(f.read()) - rendered = template.render( - use_https=use_https, - ) - - with open('conf/nginx/nginx.conf', 'w') as f: - f.write(rendered) + write_config('conf/nginx/nginx.conf', + use_https=use_https) def generate_server_config(config): @@ -28,21 +29,15 @@ def generate_server_config(config): Generates server config from the app config """ tuf_server = config.get('TUF_SERVER', None) - signing_enabled = tuf_server is not None + signing_enabled = config.get('FEATURE_SIGNING', False) - with open("conf/nginx/server-base.conf.jnj") as f: - template = jinja2.Template(f.read()) - rendered = template.render( - signing_enabled=signing_enabled, - tuf_server=tuf_server, - ) - - with open('conf/nginx/server-base.conf', 'w') as f: - f.write(rendered) + write_config('conf/nginx/server-base.conf', + tuf_server=tuf_server, + signing_enabled=signing_enabled) if __name__ == "__main__": with open('conf/stack/config.yaml', 'r') as f: config = yaml.load(f) - generate_server_config(config) - generate_nginx_config() + generate_server_config(config) + generate_nginx_config() diff --git a/config.py b/config.py index 6d06f7f23..f8ea61aed 100644 --- a/config.py +++ b/config.py @@ -168,7 +168,7 @@ class DefaultConfig(object): # Feature Flag: Whether Dex login is supported. FEATURE_DEX_LOGIN = False - # Feature flag: whether to enable support chat + # Feature Flag: whether to enable support chat FEATURE_SUPPORT_CHAT = False # Feature Flag: Whether to support GitHub build triggers. @@ -228,6 +228,9 @@ class DefaultConfig(object): # Feature Flag: Whether to collect and support user metadata. FEATURE_USER_METADATA = False + # Feature Flag: Whether to support signing + FEATURE_SIGNING = False + # The namespace to use for library repositories. # Note: This must remain 'library' until Docker removes their hard-coded namespace for libraries. # See: https://github.com/docker/docker/blob/master/registry/session.go#L320