Merge pull request #12106 from heww/clean-clair-url

refactor(configuration): cleanup unneeded CLAIR_URL configuration in core
This commit is contained in:
Steven Zou 2020-06-01 19:24:19 +08:00 committed by GitHub
commit c7c1742b88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 0 additions and 10 deletions

View File

@ -35,7 +35,6 @@ CLAIR_DB_SSLMODE={{clair_db_sslmode}}
CORE_URL={{core_url}}
CORE_LOCAL_URL={{core_local_url}}
JOBSERVICE_URL={{jobservice_url}}
CLAIR_URL={{clair_url}}
CLAIR_ADAPTER_URL={{clair_adapter_url}}
TRIVY_ADAPTER_URL={{trivy_adapter_url}}
NOTARY_URL={{notary_url}}

View File

@ -16,7 +16,6 @@ var TestDBConfig = map[string]interface{}{
"postgresql_username": "postgres",
"postgresql_sslmode": "disable",
"email_host": "127.0.0.1",
"clair_url": "http://clair:6060",
"scan_all_policy": `{"parameter":{"daily_time":0},"type":"daily"}`,
}
@ -33,7 +32,6 @@ func TestLoadFromDatabase(t *testing.T) {
configManager.UpdateConfig(TestDBConfig)
configManager.Load()
assert.Equal(t, "127.0.0.1", configManager.Get("email_host").GetString())
assert.Equal(t, "http://clair:6060", configManager.Get("clair_url").GetString())
assert.Equal(t, `{"parameter":{"daily_time":0},"type":"daily"}`, configManager.Get("scan_all_policy").GetString())
}

View File

@ -71,7 +71,6 @@ var (
{Name: common.ClairDBPort, Scope: SystemScope, Group: ClairGroup, EnvKey: "CLAIR_DB_PORT", DefaultValue: "5432", ItemType: &PortType{}, Editable: false},
{Name: common.ClairDBSSLMode, Scope: SystemScope, Group: ClairGroup, EnvKey: "CLAIR_DB_SSLMODE", DefaultValue: "disable", ItemType: &StringType{}, Editable: false},
{Name: common.ClairDBUsername, Scope: SystemScope, Group: ClairGroup, EnvKey: "CLAIR_DB_USERNAME", DefaultValue: "postgres", ItemType: &StringType{}, Editable: false},
{Name: common.ClairURL, Scope: SystemScope, Group: ClairGroup, EnvKey: "CLAIR_URL", DefaultValue: "http://clair:6060", ItemType: &StringType{}, Editable: false},
{Name: common.ClairAdapterURL, Scope: SystemScope, Group: ClairGroup, EnvKey: "CLAIR_ADAPTER_URL", DefaultValue: "http://clair-adapter:8080", ItemType: &StringType{}, Editable: false},
{Name: common.TrivyAdapterURL, Scope: SystemScope, Group: ClairGroup, EnvKey: "TRIVY_ADAPTER_URL", DefaultValue: "http://trivy-adapter:8080", ItemType: &StringType{}, Editable: false},

View File

@ -122,7 +122,6 @@ const (
UserMember = "u"
GroupMember = "g"
ReadOnly = "read_only"
ClairURL = "clair_url"
ClairAdapterURL = "clair_adapter_url"
TrivyAdapterURL = "trivy_adapter_url"
NotaryURL = "notary_url"

View File

@ -330,11 +330,6 @@ func WithClair() bool {
return cfgMgr.Get(common.WithClair).GetBool()
}
// ClairEndpoint returns the end point of clair instance, by default it's the one deployed within Harbor.
func ClairEndpoint() string {
return cfgMgr.Get(common.ClairURL).GetString()
}
// ClairDB return Clair db info
func ClairDB() (*models.PostGreSQL, error) {
clairDB := &models.PostGreSQL{