Documentation ¶
Index ¶
- Constants
- Variables
- func AuditLogForwardEndpoint(ctx context.Context) string
- func AuthMode(ctx context.Context) (string, error)
- func BannerMessage(ctx context.Context) string
- func CacheEnabled() bool
- func CacheExpireHours() int
- func CoreSecret() string
- func Database() (*models.Database, error)
- func ExtEndpoint() (string, error)
- func ExtURL() (string, error)
- func GDPRSetting(ctx context.Context) (*cfgModels.GDPRSetting, error)
- func GetBeegoMaxMemoryBytes() int64
- func GetBeegoMaxUploadSizeBytes() int64
- func GetCoreURL() string
- func GetExecutionStatusRefreshIntervalSeconds() int64
- func GetGCTimeWindow() int64
- func GetPermittedRegistryTypesForProxyCache() []string
- func GetPortalURL() string
- func GetQuotaUpdateProvider() string
- func GetRegistryCtlURL() string
- func GetSystemCfg(ctx context.Context) (map[string]interface{}, error)
- func HTTPAuthProxySetting(ctx context.Context) (*cfgModels.HTTPAuthProxy, error)
- func Init()
- func InitTraceConfig(ctx context.Context)
- func InitWithSettings(cfgs map[string]interface{}, kp ...encrypt.KeyProvider)
- func InitialAdminPassword() (string, error)
- func InternalCoreURL() string
- func InternalJobServiceURL() string
- func InternalTokenServiceEndpoint() string
- func JobserviceSecret() string
- func LDAPConf(ctx context.Context) (*cfgModels.LdapConf, error)
- func LDAPGroupConf(ctx context.Context) (*cfgModels.GroupConf, error)
- func Load(ctx context.Context) error
- func LocalCoreURL() string
- func Metric() *models.Metric
- func NewContext(ctx context.Context, m Manager) context.Context
- func NotificationEnable(ctx context.Context) bool
- func OIDCSetting(ctx context.Context) (*cfgModels.OIDCSetting, error)
- func OnlyAdminCreateProject(ctx context.Context) (bool, error)
- func PullAuditLogDisable(ctx context.Context) bool
- func PullCountUpdateDisable(ctx context.Context) bool
- func PullTimeUpdateDisable(ctx context.Context) bool
- func QuotaPerProjectEnable(ctx context.Context) bool
- func QuotaSetting(ctx context.Context) (*cfgModels.QuotaSetting, error)
- func ReadOnly(ctx context.Context) bool
- func Register(name string, mgr Manager)
- func RegistryCredential() (string, string)
- func RegistryURL() (string, error)
- func RobotPrefix(ctx context.Context) string
- func RobotTokenDuration(ctx context.Context) int
- func ScannerRobotPrefix(ctx context.Context) string
- func ScannerSkipUpdatePullTime(ctx context.Context) bool
- func SecretKey() (string, error)
- func SelfRegistration(ctx context.Context) (bool, error)
- func SessionTimeout(ctx context.Context) int64
- func SkipAuditLogDatabase(ctx context.Context) bool
- func SplitAndTrim(s, sep string) []string
- func TokenExpiration(ctx context.Context) (int, error)
- func TokenPrivateKeyPath() string
- func TrivyAdapterURL() string
- func UAASettings(ctx context.Context) (*models.UAASettings, error)
- func Upload(cfg map[string]interface{}) error
- func WithTrivy() bool
- type Manager
Constants ¶
const (
// SessionCookieName is the name of the cookie for session ID
SessionCookieName = "sid"
)
Variables ¶
var ( // DefaultCfgManager the default change manager, default is DBCfgManager. If InMemoryConfigManager is used, need to set to InMemoryCfgManager in test code DefaultCfgManager = common.DBCfgManager )
var ( // SecretStore manages secrets SecretStore *secret.Store )
Functions ¶
func AuditLogForwardEndpoint ¶
AuditLogForwardEndpoint returns the audit log forward endpoint
func BannerMessage ¶
BannerMessage returns the customized banner message
func CacheExpireHours ¶
func CacheExpireHours() int
CacheExpireHours returns the cache expire hours for cache layer.
func CoreSecret ¶
func CoreSecret() string
CoreSecret returns a secret to mark harbor-core when communicate with other component
func ExtEndpoint ¶
ExtEndpoint returns the external URL of Harbor: protocol://host:port
func GDPRSetting ¶
func GDPRSetting(ctx context.Context) (*cfgModels.GDPRSetting, error)
GDPRSetting returns the setting of GDPR
func GetBeegoMaxMemoryBytes ¶
func GetBeegoMaxMemoryBytes() int64
GetBeegoMaxMemoryBytes returns the max memory bytes of beego config
func GetBeegoMaxUploadSizeBytes ¶
func GetBeegoMaxUploadSizeBytes() int64
GetBeegoMaxUploadSizeBytes returns the max upload size bytes of beego config
func GetExecutionStatusRefreshIntervalSeconds ¶
func GetExecutionStatusRefreshIntervalSeconds() int64
GetExecutionStatusRefreshIntervalSeconds returns the interval seconds for the refresh of execution status.
func GetGCTimeWindow ¶
func GetGCTimeWindow() int64
GetGCTimeWindow returns the reserve time window of blob.
func GetPermittedRegistryTypesForProxyCache ¶
func GetPermittedRegistryTypesForProxyCache() []string
GetPermittedRegistryTypesForProxyCache returns the permitted registry types for proxy cache
func GetQuotaUpdateProvider ¶
func GetQuotaUpdateProvider() string
GetQuotaUpdateProvider returns the provider for updating quota.
func GetRegistryCtlURL ¶
func GetRegistryCtlURL() string
GetRegistryCtlURL returns the URL of registryctl
func GetSystemCfg ¶
GetSystemCfg returns the all configurations
func HTTPAuthProxySetting ¶
func HTTPAuthProxySetting(ctx context.Context) (*cfgModels.HTTPAuthProxy, error)
HTTPAuthProxySetting returns the setting of HTTP Auth proxy. the settings are only meaningful when the auth_mode is set to http_auth
func Init ¶
func Init()
Init configurations need to import following package before calling it _ "github.com/goharbor/harbor/src/pkg/config/db"
func InitTraceConfig ¶
func InitWithSettings ¶
func InitWithSettings(cfgs map[string]interface{}, kp ...encrypt.KeyProvider)
InitWithSettings init config with predefined configs, and optionally overwrite the keyprovider need to import following package before calling it _ "github.com/goharbor/harbor/src/pkg/config/inmemory"
func InitialAdminPassword ¶
InitialAdminPassword returns the initial password for administrator
func InternalCoreURL ¶
func InternalCoreURL() string
InternalCoreURL returns the local harbor core url
func InternalJobServiceURL ¶
func InternalJobServiceURL() string
InternalJobServiceURL returns jobservice URL for internal communication between Harbor containers
func InternalTokenServiceEndpoint ¶
func InternalTokenServiceEndpoint() string
InternalTokenServiceEndpoint returns token service endpoint for internal communication between Harbor containers
func JobserviceSecret ¶
func JobserviceSecret() string
JobserviceSecret returns a secret to mark Jobservice when communicate with other component TODO replace it with method of SecretStore
func LDAPGroupConf ¶
LDAPGroupConf returns the setting of ldap group search
func NewContext ¶
NewContext returns context with CfgManager
func NotificationEnable ¶
NotificationEnable returns a bool to indicates if notification enabled in harbor
func OIDCSetting ¶
func OIDCSetting(ctx context.Context) (*cfgModels.OIDCSetting, error)
OIDCSetting returns the setting of OIDC provider, currently there's only one OIDC provider allowed for Harbor and it's only effective when auth_mode is set to oidc_auth
func OnlyAdminCreateProject ¶
OnlyAdminCreateProject returns the flag to restrict that only sys admin can create project
func PullAuditLogDisable ¶
PullAuditLogDisable returns a bool to indicate if pull audit log is disable for pull request.
func PullCountUpdateDisable ¶
PullCountUpdateDisable returns a bool to indicate if pull count is disable for pull request.
func PullTimeUpdateDisable ¶
PullTimeUpdateDisable returns a bool to indicate if pull time is disable for pull request.
func QuotaPerProjectEnable ¶
QuotaPerProjectEnable returns a bool to indicates if quota per project enabled in harbor
func QuotaSetting ¶
func QuotaSetting(ctx context.Context) (*cfgModels.QuotaSetting, error)
QuotaSetting returns the setting of quota.
func RegistryCredential ¶
RegistryCredential returns the username and password the core uses to access registry
func RobotPrefix ¶
RobotPrefix user defined robot name prefix.
func RobotTokenDuration ¶
RobotTokenDuration returns the token expiration time of robot account (in minute)
func ScannerRobotPrefix ¶
ScannerRobotPrefix returns the scanner of robot account prefix.
func ScannerSkipUpdatePullTime ¶
ScannerSkipUpdatePullTime returns the scanner skip update pull time setting
func SelfRegistration ¶
SelfRegistration returns the enablement of self registration
func SessionTimeout ¶
SessionTimeout returns the session timeout for web (in minute).
func SkipAuditLogDatabase ¶
SkipAuditLogDatabase returns the audit log forward endpoint
func TokenExpiration ¶
TokenExpiration returns the token expiration time (in minute)
func TokenPrivateKeyPath ¶
func TokenPrivateKeyPath() string
TokenPrivateKeyPath returns the path to the key for signing token for registry
func TrivyAdapterURL ¶
func TrivyAdapterURL() string
TrivyAdapterURL returns the endpoint URL of a Trivy adapter instance, by default it's the one deployed within Harbor.
func UAASettings ¶
func UAASettings(ctx context.Context) (*models.UAASettings, error)
UAASettings returns the UAASettings to access UAA service.
Types ¶
type Manager ¶
type Manager interface { Load(ctx context.Context) error Set(ctx context.Context, key string, value interface{}) Save(ctx context.Context) error Get(ctx context.Context, key string) *metadata.ConfigureValue UpdateConfig(ctx context.Context, cfgs map[string]interface{}) error GetUserCfgs(ctx context.Context) map[string]interface{} ValidateCfg(ctx context.Context, cfgs map[string]interface{}) error GetAll(ctx context.Context) map[string]interface{} GetDatabaseCfg() *comModels.Database }
Manager defines the operation for config
func FromContext ¶
FromContext returns CfgManager from context
func GetCfgManager ¶
GetCfgManager return the current config manager
func GetManager ¶
GetManager get the configure manager by name