mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-30 11:31:24 +01:00
Merge pull request #4832 from reasonerjt/master
Overwrite some values in harbor.cfg -- apply the change to master branch.
This commit is contained in:
commit
5757e8475d
@ -3,6 +3,13 @@ import utils
|
||||
import os
|
||||
acceptable_versions = ['1.2.0', '1.3.0', '1.4.0']
|
||||
|
||||
#The dict overwrite is for overwriting any value that was set in previous cfg,
|
||||
#which needs a new value in new version of .cfg
|
||||
overwrite = {
|
||||
'redis_url':'redis:6379',
|
||||
'max_job_workers':'50'
|
||||
}
|
||||
#The dict default is for filling in the values that are not set in previous config files.
|
||||
#In 1.5 template the placeholder has the same value as the attribute name.
|
||||
default = {
|
||||
'log_rotate_count':'50',
|
||||
@ -10,7 +17,6 @@ default = {
|
||||
'db_host':'mysql',
|
||||
'db_port':'3306',
|
||||
'db_user':'root',
|
||||
'redis_url':'',
|
||||
'clair_db_host':'postgres',
|
||||
'clair_db_port':'5432',
|
||||
'clair_db_username':'postgres',
|
||||
@ -27,11 +33,14 @@ default = {
|
||||
def migrate(input_cfg, output_cfg):
|
||||
d = utils.read_conf(input_cfg)
|
||||
keys = list(default.keys())
|
||||
keys.extend(overwrite.keys())
|
||||
keys.extend(['hostname', 'ui_url_protocol', 'max_job_workers', 'customize_crt',
|
||||
'ssl_cert', 'ssl_cert_key', 'secretkey_path', 'admiral_url', 'db_password', 'clair_db_password'])
|
||||
val = {}
|
||||
for k in keys:
|
||||
if k in d:
|
||||
if k in overwrite:
|
||||
val[k] = overwrite[k]
|
||||
elif k in d:
|
||||
val[k] = d[k]
|
||||
else:
|
||||
val[k] = default[k]
|
||||
|
Loading…
Reference in New Issue
Block a user