config

package
Version: v1.8.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package config provide config for core api and other modules Before accessing user settings, need to call Load() For system settings, no need to call Load()

Index

Constants

View Source
const (

	// SessionCookieName is the name of the cookie for session ID
	SessionCookieName = "sid"
)

Variables

View Source
var (
	// SecretStore manages secrets
	SecretStore *secret.Store
	// GlobalProjectMgr is initialized based on the deploy mode
	GlobalProjectMgr promgr.ProjectManager

	// AdmiralClient is initialized only under integration deploy mode
	// and can be passed to project manager as a parameter
	AdmiralClient *http.Client
	// TokenReader is used in integration mode to read token
	TokenReader admiral.TokenReader
)

Functions

func AdmiralEndpoint

func AdmiralEndpoint() string

AdmiralEndpoint returns the URL of admiral, if Harbor is not deployed with admiral it should return an empty string.

func AuthMode

func AuthMode() (string, error)

AuthMode ...

func ClairDB

func ClairDB() (*models.PostGreSQL, error)

ClairDB return Clair db info

func ClairEndpoint

func ClairEndpoint() string

ClairEndpoint returns the end point of clair instance, by default it's the one deployed within Harbor.

func CoreSecret

func CoreSecret() string

CoreSecret returns a secret to mark harbor-core when communicate with other component

func Database

func Database() (*models.Database, error)

Database returns database settings

func Email

func Email() (*models.Email, error)

Email returns email server settings

func ExtEndpoint

func ExtEndpoint() (string, error)

ExtEndpoint returns the external URL of Harbor: protocol://host:port

func ExtURL

func ExtURL() (string, error)

ExtURL returns the external URL: host:port

func GetCfgManager added in v1.8.0

func GetCfgManager() *comcfg.CfgManager

GetCfgManager return the current config manager

func GetChartMuseumEndpoint

func GetChartMuseumEndpoint() (string, error)

GetChartMuseumEndpoint returns the endpoint of the chartmuseum service otherwise an non nil error is returned

func GetClairHealthCheckServerURL added in v1.8.0

func GetClairHealthCheckServerURL() string

GetClairHealthCheckServerURL returns the URL of the health check server of Clair

func GetPortalURL added in v1.8.0

func GetPortalURL() string

GetPortalURL returns the URL of portal

func GetRedisOfRegURL added in v1.8.0

func GetRedisOfRegURL() string

GetRedisOfRegURL returns the URL of Redis used by registry

func GetRegistryCtlURL added in v1.8.0

func GetRegistryCtlURL() string

GetRegistryCtlURL returns the URL of registryctl

func GetSystemCfg

func GetSystemCfg() (map[string]interface{}, error)

GetSystemCfg returns the system configurations

func HTTPAuthProxySetting added in v1.8.0

func HTTPAuthProxySetting() (*models.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() error

Init configurations

func InitWithSettings added in v1.8.0

func InitWithSettings(cfgs map[string]interface{}, kp ...comcfg.KeyProvider)

InitWithSettings init config with predefined configs, and optionally overwrite the keyprovider

func InitialAdminPassword

func InitialAdminPassword() (string, error)

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 InternalNotaryEndpoint

func InternalNotaryEndpoint() string

InternalNotaryEndpoint returns notary server endpoint for internal communication between Harbor containers This is currently a conventional value and can be unaccessible when Harbor is not deployed with Notary.

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 LDAPConf

func LDAPConf() (*models.LdapConf, error)

LDAPConf returns the setting of ldap server

func LDAPGroupConf

func LDAPGroupConf() (*models.LdapGroupConf, error)

LDAPGroupConf returns the setting of ldap group search

func Load

func Load() error

Load configurations

func OIDCSetting added in v1.8.0

func OIDCSetting() (*models.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

func OnlyAdminCreateProject() (bool, error)

OnlyAdminCreateProject returns the flag to restrict that only sys admin can create project

func ReadOnly

func ReadOnly() bool

ReadOnly returns a bool to indicates if Harbor is in read only mode.

func RegistryURL

func RegistryURL() (string, error)

RegistryURL ...

func RobotTokenDuration added in v1.8.0

func RobotTokenDuration() int

RobotTokenDuration returns the token expiration time of robot account (in minute)

func ScanAllPolicy

func ScanAllPolicy() models.ScanAllPolicy

ScanAllPolicy returns the policy which controls the scan all.

func SecretKey

func SecretKey() (string, error)

SecretKey returns the secret key to encrypt the password of target

func SelfRegistration

func SelfRegistration() (bool, error)

SelfRegistration returns the enablement of self registration

func TokenExpiration

func TokenExpiration() (int, error)

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 UAASettings

func UAASettings() (*models.UAASettings, error)

UAASettings returns the UAASettings to access UAA service.

func Upload

func Upload(cfg map[string]interface{}) error

Upload save all system configurations

func WithAdmiral

func WithAdmiral() bool

WithAdmiral returns a bool to indicate if Harbor's deployed with admiral.

func WithChartMuseum

func WithChartMuseum() bool

WithChartMuseum returns a bool to indicate if chartmuseum is deployed with Harbor.

func WithClair

func WithClair() bool

WithClair returns a bool value to indicate if Harbor's deployed with Clair

func WithNotary

func WithNotary() bool

WithNotary returns a bool value to indicate if Harbor's deployed with Notary

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL