Merge pull request #7640 from ninjadq/remove_env_duplicate_items

Remove duplicate env items
This commit is contained in:
Daniel Jiang 2019-05-09 15:35:26 +08:00 committed by GitHub
commit a67cc2b8b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 58 deletions

View File

@ -1,36 +0,0 @@
PORT=8080
LOG_LEVEL={{log_level}}
EXT_ENDPOINT={{public_url}}
DATABASE_TYPE=postgresql
POSTGRESQL_HOST={{db_host}}
POSTGRESQL_PORT={{db_port}}
POSTGRESQL_USERNAME={{db_user}}
POSTGRESQL_PASSWORD={{db_password}}
POSTGRESQL_DATABASE=registry
POSTGRESQL_SSLMODE=disable
REGISTRY_URL={{registry_url}}
TOKEN_SERVICE_URL={{token_service_url}}
HARBOR_ADMIN_PASSWORD={{harbor_admin_password}}
MAX_JOB_WORKERS={{max_job_workers}}
CORE_SECRET={{core_secret}}
JOBSERVICE_SECRET={{jobservice_secret}}
CFG_EXPIRATION=5
ADMIRAL_URL={{admiral_url}}
WITH_NOTARY={{with_notary}}
WITH_CLAIR={{with_clair}}
CLAIR_DB_PASSWORD={{db_password}}
CLAIR_DB_HOST={{db_host}}
CLAIR_DB_PORT={{db_port}}
CLAIR_DB_USERNAME={{db_user}}
CLAIR_DB={{clair_db}}
CLAIR_DB_SSLMODE=disable
CORE_URL={{core_url}}
JOBSERVICE_URL={{jobservice_url}}
CLAIR_URL={{clair_url}}
NOTARY_URL={{notary_url}}
REGISTRY_STORAGE_PROVIDER_NAME={{storage_provider_name}}
READ_ONLY=false
RELOAD_KEY={{reload_key}}
CHART_REPOSITORY_URL={{chart_repository_url}}
REGISTRY_CONTROLLER_URL={{registry_controller_url}}
WITH_CHARTMUSEUM={{with_chartmuseum}}

View File

@ -1,9 +1,43 @@
LOG_LEVEL=info
CONFIG_PATH=/etc/core/app.conf
CORE_SECRET={{core_secret}}
JOBSERVICE_SECRET={{jobservice_secret}}
UAA_CA_ROOT=/etc/core/certificates/uaa_ca.pem
_REDIS_URL={{redis_host}}:{{redis_port}},100,{{redis_password}}
SYNC_REGISTRY=false
CHART_CACHE_DRIVER={{chart_cache_driver}}
_REDIS_URL_REG={{redis_url_reg}}
_REDIS_URL_REG={{redis_url_reg}}
PORT=8080
LOG_LEVEL={{log_level}}
EXT_ENDPOINT={{public_url}}
DATABASE_TYPE=postgresql
POSTGRESQL_HOST={{db_host}}
POSTGRESQL_PORT={{db_port}}
POSTGRESQL_USERNAME={{db_user}}
POSTGRESQL_PASSWORD={{db_password}}
POSTGRESQL_DATABASE=registry
POSTGRESQL_SSLMODE=disable
REGISTRY_URL={{registry_url}}
TOKEN_SERVICE_URL={{token_service_url}}
HARBOR_ADMIN_PASSWORD={{harbor_admin_password}}
MAX_JOB_WORKERS={{max_job_workers}}
CORE_SECRET={{core_secret}}
JOBSERVICE_SECRET={{jobservice_secret}}
CFG_EXPIRATION=5
ADMIRAL_URL={{admiral_url}}
WITH_NOTARY={{with_notary}}
WITH_CLAIR={{with_clair}}
CLAIR_DB_PASSWORD={{db_password}}
CLAIR_DB_HOST={{db_host}}
CLAIR_DB_PORT={{db_port}}
CLAIR_DB_USERNAME={{db_user}}
CLAIR_DB={{clair_db}}
CLAIR_DB_SSLMODE=disable
CORE_URL={{core_url}}
JOBSERVICE_URL={{jobservice_url}}
CLAIR_URL={{clair_url}}
NOTARY_URL={{notary_url}}
REGISTRY_STORAGE_PROVIDER_NAME={{storage_provider_name}}
READ_ONLY=false
RELOAD_KEY={{reload_key}}
CHART_REPOSITORY_URL={{chart_repository_url}}
REGISTRY_CONTROLLER_URL={{registry_controller_url}}
WITH_CHARTMUSEUM={{with_chartmuseum}}

View File

@ -121,7 +121,6 @@ services:
container_name: harbor-core
env_file:
- ./common/config/core/env
- ./common/config/core/config_env
restart: always
cap_drop:
- ALL

View File

@ -10,9 +10,6 @@ core_conf_env = os.path.join(config_dir, "core", "env")
core_conf_template_path = os.path.join(templates_dir, "core", "app.conf.jinja")
core_conf = os.path.join(config_dir, "core", "app.conf")
core_config_env_template = os.path.join(templates_dir, "core", "config_env.jinja")
core_config_env = os.path.join(config_dir, "core", "config_env")
def prepare_core(config_dict, with_notary, with_clair, with_chartmuseum):
prepare_core_config_dir()
# Render Core
@ -23,12 +20,13 @@ def prepare_core(config_dict, with_notary, with_clair, with_chartmuseum):
else:
chart_cache_driver = "memory"
render_config_env(config_dict, with_notary, with_clair, with_chartmuseum)
render_jinja(
core_env_template_path,
core_conf_env,
chart_cache_driver=chart_cache_driver,
with_notary=with_notary,
with_clair=with_clair,
with_chartmuseum=with_chartmuseum,
**config_dict)
# Copy Core app.conf
@ -40,15 +38,3 @@ def prepare_core_config_dir():
def copy_core_config(core_templates_path, core_config_path):
shutil.copyfile(core_templates_path, core_config_path)
print("Generated configuration file: %s" % core_config_path)
def render_config_env(config_dict, with_notary, with_clair, with_chartmuseum):
# Use reload_key to avoid reload config after restart harbor
render_jinja(
core_config_env_template,
core_config_env,
with_notary=with_notary,
with_clair=with_clair,
with_chartmuseum=with_chartmuseum,
**config_dict
)