Documentation ¶
Index ¶
- Constants
- Variables
- func AdvertiseHost() string
- func ApplicationWorkingDir(dirType ...ApplicationDirType) string
- func AsCoreContext(ctx context.Context) context.Context
- func BindHost() string
- func BrokerURL() string
- func BuildForkParams(cmd string) []string
- func CertsStoreLocalLocation() string
- func CertsStoreURL() string
- func Cluster() string
- func ConfigIsLocalFile() bool
- func ConfigURL() string
- func CoreBackground() context.Context
- func DefaultAdvertiseAddress() string
- func DiscoveryURL() string
- func DocRegisteredEnvVariables(excludes ...string) string
- func GetBool(key string) bool
- func GetClientConn(ctx context.Context) grpc.ClientConnInterface
- func GetHostname() string
- func GetPID() string
- func GetPPID() string
- func GetServiceName(ctx context.Context) string
- func GetString(key string) string
- func GetStringSlice(key string) []string
- func GrpcBindAddress() string
- func GrpcDiscoveryBindAddress() string
- func GrpcExternalPort() string
- func HasCapacity(c string) bool
- func HttpBindAddress() string
- func HttpServerType() string
- func Init(ctx context.Context, typ string)
- func IsCoreContext(ctx context.Context) bool
- func IsFork() bool
- func IsGrpcScheme(u string) bool
- func IsRequired(name string, tags ...string) bool
- func IsSet(key string) bool
- func KeyringURL() string
- func LastInitType() string
- func LogJSON() bool
- func LogLevel() string
- func LogToFile() bool
- func MatchDependencies(ctx context.Context, rr map[string]string) error
- func MultiMatches(ctx1, ctx2 context.Context) bool
- func MustServiceDataDir(serviceName string) string
- func Name() string
- func NeedsGrpcDiscoveryConn() (bool, string)
- func ProcessRootID() string
- func ProcessStartTags() []string
- func ProxyServerURL() string
- func Register(typ string, y ...func(ctx context.Context))
- func RegisterDependencyMatcher(key string, f func(context.Context, string) error)
- func RegisterEnvVariable(key, def, description string, isBool ...bool)
- func RegisterMultiContextManager(m MultiContextProvider)
- func RegisterPreRun(preRun func(runtime Runtime))
- func RegistryURL() string
- func ServiceDataDir(serviceName string) (string, error)
- func SetArgs(aa []string)
- func SetDefault(key string, value interface{})
- func SetProcessRootID(id string)
- func SetRuntime(runtime Runtime)
- func SetVaultMasterKey(masterKey string)
- func TODOKnownEmpty(ctx context.Context) context.Context
- func VaultURL() string
- func WithClientConn(ctx context.Context, reg grpc.ClientConnInterface) context.Context
- func WithServiceName(ctx context.Context, serviceName string) context.Context
- type ApplicationDirType
- type ContextProvider
- type InfoGroup
- type InfoPair
- type MultiContextProvider
- type Option
- type Options
- type Resolver
- type Runtime
Constants ¶
const ( KeyName = "name" KeyBootstrapTpl = "bootstrap_template" KeyBootstrapFile = "bootstrap_file" KeyBootstrapRoot = "bootstrap_root" KeyBootstrapYAML = "bootstrap_yaml" KeyBootstrapSet = "set" KeyBootstrapSetsFile = "sets" KeyCluster = "cluster" KeyDiscovery = "discovery" KeyRegistry = "registry" KeyBroker = "broker" KeyConfig = "config" KeyVault = "vault" KeyKeyring = "keyring" KeyCertsStore = "certs_store" KeyFork = "fork" KeyForkLegacy = "is_fork" KeyArgTags = "tags" KeyArgExclude = "exclude" KeyNodeCapacity = "cap" KeyAdvertiseAddress = "advertise_address" KeyBindHost = "bind_address" KeyGrpcDiscoveryPort = "grpc_discovery_port" KeyGrpcPort = "grpc_port" KeyHttpPort = "http_port" KeyGrpcExternal = "grpc_external" KeySiteBind = "site_bind" KeySiteExternal = "site_external" KeySiteNoTLS = "site_no_tls" KeySiteTlsCertFile = "site_tls_cert_file" KeySiteTlsKeyFile = "site_tls_key_file" KeySiteLetsEncryptEmail = "site_le_email" KeySiteLetsEncryptAgree = "site_le_agree" KeySiteLetsEncryptStaging = "site_le_staging" // Legacy versions without "site_" prefix KeySiteBindL = "bind" KeySiteExternalL = "external" KeySiteNoTLSL = "no_tls" KeySiteTlsCertFileL = "tls_cert_file" KeySiteTlsKeyFileL = "tls_key_file" KeySiteLetsEncryptEmailL = "le_email" KeySiteLetsEncryptAgreeL = "le_agree" KeySiteLetsEncryptStagingL = "le_staging" KeyInstallCli = "install_cli" KeyInstallYaml = "install_yaml" KeyInstallJson = "install_json" KeyInstallExitAfter = "exit_after_install" KeyInstallCliLegacy = "cli" KeyInstallYamlLegacy = "yaml" KeyInstallJsonLegacy = "json" KeyLog = "log" KeyLogJson = "log_json" KeyLogToFile = "log_to_file" KeyLogSQL = "log_sql" KeyHttpProxyURL = "http_proxy" KeyHttpServer = "http" HttpServerCaddy = "caddy" HttpServerNative = "http" DefaultDiscoveryPort = "8030" DefaultGrpcPort = "0" DefaultBindingSitePort = "8080" DefaultHttpPort = "0" DefaultConfigFileName = "pydio.json" DefaultVaultFileName = "pydio-vault.json" DefaultKeyringFileName = "cells-vault-key" DefaultCertStorePath = "certs" DefaultConfigSuffix = "/config" DefaultVaultSuffix = "/vault" DefaultRegistrySuffix = "/registry" DefaultBrokerSuffix = "/broker" DefaultCacheSuffix = "/cache" DefaultShortCacheSuffix = "/shortcache" DefaultQueueSuffix = "/queue" // Deprecated keys - but env vars can still be read KeyEnableMetrics = "enable_metrics" KeyEnablePprof = "enable_pprof" )
const ( NodeMetaPID = "PID" NodeMetaParentPID = "parentPID" NodeMetaMetrics = "metrics" NodeMetaStartTag = "start" NodeMetaForkStartTag = "forkStartTag" NodeMetaHostName = "hostname" NodeMetaCapacities = "capacities" NodeRootID = "rootID" NodeMetaCluster = "cluster" )
const ( NsMain = "main" NsDiscovery = "discovery" NsInstall = "install" NsConnReady = "conn-ready" )
Variables ¶
var ( DefaultKeyDiscovery = "mem://" DefaultKeyRegistry = "mem://?cache=shared" DefaultKeyBroker = "mem://" DefaultKeyConfig = "file://" + filepath.ToSlash(filepath.Join(ApplicationWorkingDir(), DefaultConfigFileName)) DefaultKeyKeyring = "file://" + filepath.ToSlash(filepath.Join(ApplicationWorkingDir(), DefaultKeyringFileName)+"?keyring=true") DefaultKeyCertsStore = "file://" + filepath.ToSlash(filepath.Join(ApplicationWorkingDir(), DefaultCertStorePath)) DefaultKeyVault = "detect" )
var (
MultiContextKey = mCtxKey{}
)
var (
ServiceNameKey = serviceNameKey{}
)
Functions ¶
func AdvertiseHost ¶
func AdvertiseHost() string
func ApplicationWorkingDir ¶
func ApplicationWorkingDir(dirType ...ApplicationDirType) string
ApplicationWorkingDir creates a local file to store pydio system data
func BuildForkParams ¶
BuildForkParams creates --key=value arguments from runtime parameters
func CertsStoreLocalLocation ¶
func CertsStoreLocalLocation() string
func CertsStoreURL ¶
func CertsStoreURL() string
func ConfigIsLocalFile ¶
func ConfigIsLocalFile() bool
ConfigIsLocalFile checks if ConfigURL scheme is file
func CoreBackground ¶
func DefaultAdvertiseAddress ¶
func DefaultAdvertiseAddress() string
DefaultAdvertiseAddress reads or compute the address advertised to clients
func DiscoveryURL ¶
func DiscoveryURL() string
DiscoveryURL returns the scheme://address url for Registry
func GetClientConn ¶
func GetClientConn(ctx context.Context) grpc.ClientConnInterface
GetClientConn returns the client connection from the context in argument
func GetHostname ¶
func GetHostname() string
GetHostname wraps os.Hostname, could be overwritten by env or parameter.
func GetServiceName ¶
GetServiceName returns the service name associated to this context
func GetStringSlice ¶
GetStringSlice gets a slice from global runtime.
func GrpcBindAddress ¶
func GrpcBindAddress() string
GrpcBindAddress returns the KeyBindHost:KeyGrpcPort URL
func GrpcDiscoveryBindAddress ¶
func GrpcDiscoveryBindAddress() string
GrpcDiscoveryBindAddress returns the KeyBindHost:KeyGrpcDiscoveryPort URL
func GrpcExternalPort ¶
func GrpcExternalPort() string
GrpcExternalPort returns optional GRPC port to be used for external binding
func HasCapacity ¶
HasCapacity checks if a specific capacity is registered for the current process
func HttpBindAddress ¶
func HttpBindAddress() string
HttpBindAddress returns the KeyBindHost:KeyHttpPort URL
func HttpServerType ¶
func HttpServerType() string
HttpServerType returns one of HttpServerCaddy or HttpServerCore
func IsCoreContext ¶
func IsFork ¶
func IsFork() bool
IsFork checks if the runtime is originally a fork of a different process
func IsGrpcScheme ¶
func IsRequired ¶
IsRequired checks arguments, --tags and --exclude against a service name
func KeyringURL ¶
func KeyringURL() string
func LastInitType ¶
func LastInitType() string
func MatchDependencies ¶
MatchDependencies checks a list of known keys for specific runtime parameters. It is typically used to detect current-process aspects
func MultiMatches ¶
MultiMatches compares two contexts
func MustServiceDataDir ¶
MustServiceDataDir returns the applicationdir/services/serviceName and ignore error it if it does not exists
func NeedsGrpcDiscoveryConn ¶
func ProcessRootID ¶
func ProcessRootID() string
ProcessRootID retrieves a unique identifier for the current process
func ProcessStartTags ¶
func ProcessStartTags() []string
ProcessStartTags returns a list of tags to be used for identifying processes
func ProxyServerURL ¶
func ProxyServerURL() string
ProxyServerURL defines which proxy to use for serving Sites
func RegisterDependencyMatcher ¶
RegisterDependencyMatcher adds a key-based dependency matcher to internal registry.
func RegisterEnvVariable ¶
RegisterEnvVariable can be called by any contributor to declare environment variables for documentation purpose
func RegisterMultiContextManager ¶
func RegisterMultiContextManager(m MultiContextProvider)
func RegisterPreRun ¶
func RegisterPreRun(preRun func(runtime Runtime))
func RegistryURL ¶
func RegistryURL() string
RegistryURL returns the scheme://address url for Registry
func ServiceDataDir ¶
ServiceDataDir returns the applicationdir/services/serviceName and creates it if it does not exists
func SetProcessRootID ¶
func SetProcessRootID(id string)
SetProcessRootID passes a UUID for the current process
func SetVaultMasterKey ¶
func SetVaultMasterKey(masterKey string)
func WithClientConn ¶
WithClientConn links a client connection to the context
Types ¶
type ApplicationDirType ¶
type ApplicationDirType int
const ( ApplicationDirData ApplicationDirType = iota ApplicationDirLogs ApplicationDirServices )
type ContextProvider ¶
type MultiContextProvider ¶
type MultiContextProvider interface { Current(ctx context.Context) string RootContext(ctx context.Context) context.Context Iterate(ctx context.Context, add func(context.Context, string) error) error Watch(ctx context.Context, add func(context.Context, string) error, remove func(context.Context, string) error, iterate bool) error }
func MultiContextManager ¶
func MultiContextManager() MultiContextProvider