mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-26 18:48:02 +01:00
bb66358df8
* Fix migration script 1. port is string when parsed from configparser 2. remove index and db_user in if condition Signed-off-by: Qian Deng <dengq@vmware.com> * Add port to public_url Add port to public_url Signed-off-by: Qian Deng <dengq@vmware.com> * Customized value for notary and clair db config in notary and clair is hardcoded Signed-off-by: Qian Deng <dengq@vmware.com> * Add notary and clair db config in harbor.yml Add notary clair config to harbor.yml and fix related regression Signed-off-by: Qian Deng <dengq@vmware.com>
44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
import os, shutil
|
|
|
|
from g import templates_dir, config_dir, DEFAULT_UID, DEFAULT_GID
|
|
from .jinja import render_jinja
|
|
from .misc import prepare_config_dir
|
|
|
|
clair_template_dir = os.path.join(templates_dir, "clair")
|
|
|
|
def prepare_clair(config_dict):
|
|
clair_config_dir = prepare_config_dir(config_dir, "clair")
|
|
|
|
if os.path.exists(os.path.join(clair_config_dir, "postgresql-init.d")):
|
|
print("Copying offline data file for clair DB")
|
|
shutil.rmtree(os.path.join(clair_config_dir, "postgresql-init.d"))
|
|
|
|
shutil.copytree(os.path.join(clair_template_dir, "postgresql-init.d"), os.path.join(clair_config_dir, "postgresql-init.d"))
|
|
|
|
postgres_env_path = os.path.join(clair_config_dir, "postgres_env")
|
|
postgres_env_template = os.path.join(clair_template_dir, "postgres_env.jinja")
|
|
|
|
clair_config_path = os.path.join(clair_config_dir, "config.yaml")
|
|
clair_config_template = os.path.join(clair_template_dir, "config.yaml.jinja")
|
|
|
|
clair_env_path = os.path.join(clair_config_dir, "clair_env")
|
|
clair_env_template = os.path.join(clair_template_dir, "clair_env.jinja")
|
|
|
|
render_jinja(
|
|
postgres_env_template,
|
|
postgres_env_path,
|
|
**config_dict)
|
|
|
|
render_jinja(
|
|
clair_config_template,
|
|
clair_config_path,
|
|
uid=DEFAULT_UID,
|
|
gid=DEFAULT_GID,
|
|
**config_dict)
|
|
|
|
# config http proxy for Clair
|
|
render_jinja(
|
|
clair_env_template,
|
|
clair_env_path,
|
|
**config_dict)
|