mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-16 15:25:18 +01:00
Merge pull request #13425 from wy65701436/robot-prefix
add robot name prefix
This commit is contained in:
commit
7c1ad11763
@ -151,6 +151,7 @@ var (
|
||||
{Name: common.WithNotary, Scope: SystemScope, Group: BasicGroup, EnvKey: "WITH_NOTARY", DefaultValue: "false", ItemType: &BoolType{}, Editable: true},
|
||||
// the unit of expiration is minute, 43200 minutes = 30 days
|
||||
{Name: common.RobotTokenDuration, Scope: UserScope, Group: BasicGroup, EnvKey: "ROBOT_TOKEN_DURATION", DefaultValue: "43200", ItemType: &IntType{}, Editable: true},
|
||||
{Name: common.RobotNamePrefix, Scope: UserScope, Group: BasicGroup, EnvKey: "ROBOT_NAME_PREFIX", DefaultValue: "robot$", ItemType: &StringType{}, Editable: true},
|
||||
{Name: common.NotificationEnable, Scope: UserScope, Group: BasicGroup, EnvKey: "NOTIFICATION_ENABLE", DefaultValue: "true", ItemType: &BoolType{}, Editable: true},
|
||||
{Name: common.MetricEnable, Scope: SystemScope, Group: BasicGroup, EnvKey: "METRIC_ENABLE", DefaultValue: "false", ItemType: &BoolType{}, Editable: true},
|
||||
{Name: common.MetricPort, Scope: SystemScope, Group: BasicGroup, EnvKey: "METRIC_PORT", DefaultValue: "9090", ItemType: &IntType{}, Editable: true},
|
||||
|
@ -136,6 +136,8 @@ const (
|
||||
DefaultRegistryCtlURL = "http://registryctl:8080"
|
||||
// Use this prefix to distinguish harbor user, the prefix contains a special character($), so it cannot be registered as a harbor user.
|
||||
RobotPrefix = "robot$"
|
||||
// System admin defined the robot name prefix.
|
||||
RobotNamePrefix = "robot_name_prefix"
|
||||
// Use this prefix to index user who tries to login with web hook token.
|
||||
AuthProxyUserNamePrefix = "tokenreview$"
|
||||
CoreConfigPath = "/api/internal/configurations"
|
||||
|
@ -64,6 +64,7 @@ var defaultConfig = map[string]interface{}{
|
||||
common.JobServiceURL: "http://myjob:8888/",
|
||||
common.ReadOnly: false,
|
||||
common.NotaryURL: "http://notary-server:4443",
|
||||
common.RobotNamePrefix: "robot$",
|
||||
}
|
||||
|
||||
// GetDefaultConfigMap returns the defailt config map for easier modification.
|
||||
|
@ -128,6 +128,7 @@ func GetUnitTestConfig() map[string]interface{} {
|
||||
common.TokenServiceURL: "http://core:8080/service/token",
|
||||
common.RegistryURL: fmt.Sprintf("http://%s:5000", ipAddress),
|
||||
common.ReadOnly: false,
|
||||
common.RobotNamePrefix: "robot$",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -488,6 +488,11 @@ func GetGCTimeWindow() int64 {
|
||||
return common.DefaultGCTimeWindowHours
|
||||
}
|
||||
|
||||
// RobotPrefix user defined robot name prefix.
|
||||
func RobotPrefix() string {
|
||||
return cfgMgr.Get(common.RobotNamePrefix).GetString()
|
||||
}
|
||||
|
||||
// Metric returns the overall metric settings
|
||||
func Metric() *models.Metric {
|
||||
return &models.Metric{
|
||||
|
@ -190,6 +190,7 @@ func TestConfig(t *testing.T) {
|
||||
|
||||
assert.True(NotificationEnable())
|
||||
assert.Equal(int64(0), GetGCTimeWindow())
|
||||
assert.Equal("robot$", RobotPrefix())
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user