Documentation ¶
Overview ¶
Package config provides tools for managing configurations
Index ¶
- Constants
- Variables
- func Del(ctx context.Context, path ...string)
- func DelSecret(ctx context.Context, uuid string) error
- func ExposedConfigsForService(serviceName string) common.XMLSerializableForm
- func FactorizeMinioServers(ctx context.Context, existingConfigs map[string]*object.MinioConfig, ...) (config *object.MinioConfig, e error)
- func Get(ctx context.Context, path ...string) configx.Values
- func GetAndWatch(ctx context.Context, store Store, configPath []string, ...)
- func GetDatabase(ctx context.Context, key string) (string, string)
- func GetMinioConfigForName(ctx context.Context, name string, skipSecret bool) *object.MinioConfig
- func GetSecret(ctx context.Context, uuid string) configx.Values
- func GetSourceInfoByName(ctx context.Context, dsName string) (*object.DataSource, error)
- func GetStorageDriver(store Store, configKey, serviceName string) (driver string, dsn string, defined bool)
- func GetTLSClientConfig(ctx context.Context, t string) *tls.Config
- func GetTLSServerConfig(ctx context.Context, t string) *tls.Config
- func GetUpdatesConfigs(ctx context.Context) configx2.Values
- func HasDatabase(ctx context.Context, key string) bool
- func IndexServiceTableNames(dsName string) map[string]string
- func IsRestEditable(path string) bool
- func ListMinioConfigsFromConfig(ctx context.Context, skipSecret ...bool) map[string]*object.MinioConfig
- func ListSourcesFromConfig(ctx context.Context) map[string]*object.DataSource
- func MinioConfigNamesToConfig(ctx context.Context, sources map[string]*object.MinioConfig)
- func NewKeyForSecret() string
- func PoolFromURL[T any](ctx context.Context, u *url.URL, opener openurl.Opener[T]) map[string]*openurl.Pool[T]
- func ReferencePoolOptionsFromURL(ctx context.Context, u *url.URL) (opts []configx.Option)
- func RegisterCustomValueDiffer(differ diff.ValueDiffer)
- func RegisterExposedConfigs(serviceName string, form common.XMLSerializableForm)
- func RegisterProxy(key string, interceptors ...interface{})
- func RegisterRestEditablePath(segments ...string)
- func RegisterVaultKey(s ...string)
- func ResetTlsConfigs()
- func RevisionsStore(ctx context.Context) revisions.Store
- func Save(ctx context.Context, ctxUser string, ctxMessage string) error
- func Set(ctx context.Context, val interface{}, path ...string) error
- func SetDatabase(ctx context.Context, key string, driver string, dsn string, defaultsKey string) error
- func SetSecret(ctx context.Context, uuid string, val string) error
- func SourceNamesFiltered(names []string) []string
- func SourceNamesForDataServices(ctx context.Context, dataSrvType string) []string
- func SourceNamesFromDataConfigs(values configx.Values) []string
- func SourceNamesToConfig(ctx context.Context, sources map[string]*object.DataSource)
- func TouchSourceNamesForDataServices(ctx context.Context, dataSrvType string)
- func UnusedMinioServers(minios map[string]*object.MinioConfig, sources map[string]*object.DataSource) []string
- func Watch(ctx context.Context, opts ...watch.WatchOption) (watch.Receiver, error)
- func WatchCombined(ctx context.Context, paths [][]string, opts ...watch.WatchOption) (watch.Receiver, error)
- type DistributedStore
- type Getter
- type Options
- type ProxyDeleter
- type ProxyGetter
- type ProxySetter
- type RevisionsProvider
- type RevisionsStoreOption
- type RevisionsStoreOptions
- type Saver
- type Store
- type URLMux
- type URLOpener
Constants ¶
const ( ContextKey configKey = iota VaultKey RevisionsKey )
const ( // KeyFrontPluginEnabled is the frontend config to enable/disable plugins KeyFrontPluginEnabled = "PYDIO_PLUGIN_ENABLED" // DefaultOAuthClientID set the default client id to use DefaultOAuthClientID = "cells-frontend" )
Variables ¶
var CustomValueDiffers []diff.ValueDiffer
var SampleConfig = `{ "version": "` + common.Version().String() + `", "defaults": { "update": { "publicKey": "` + common.UpdateDefaultPublicKey + `", "updateUrl": "` + common.UpdateDefaultServerUrl + `" }, "sites": [ { "Binds": [ "0.0.0.0:8080" ], "Routing": [ { "Effect": 1, "Matcher": "*" } ], "TLSConfig": { "SelfSigned": {} } } ], "telemetry": { "loggers": [ { "encoding": "console", "level": "info", "outputs": [ "stdout:///" ] }, { "encoding": "json", "level": "info", "outputs": [ "file://` + runtime.ApplicationWorkingDir(runtime.ApplicationDirLogs) + `/pydio.log", "service:///?service=pydio.grpc.log" ] } ], "metrics": { "readers": [] }, "otelService": { "attributes": { "deployment": "local" }, "name": "cells" }, "profiling": { "publishers": [ "pull://" ] }, "tracing": { "outputs": [] } } } }`
SampleConfig is the default config used during the first install
Functions ¶
func ExposedConfigsForService ¶
func ExposedConfigsForService(serviceName string) common.XMLSerializableForm
ExposedConfigsForService returns exposed configs for service
func FactorizeMinioServers ¶
func FactorizeMinioServers(ctx context.Context, existingConfigs map[string]*object.MinioConfig, newSource *object.DataSource, update bool) (config *object.MinioConfig, e error)
FactorizeMinioServers tries to find exisiting MinioConfig that can be directly reused by the new source, or creates a new one
func GetAndWatch ¶
func GetAndWatch(ctx context.Context, store Store, configPath []string, callback func(values configx.Values))
GetAndWatch applies a callback on a current value, then watch for its changes and re-apply TODO : watcher should be cancellable with context
func GetDatabase ¶
GetDatabase retrieves the database data from the config
func GetMinioConfigForName ¶
func GetSourceInfoByName ¶
func GetStorageDriver ¶
func GetStorageDriver(store Store, configKey, serviceName string) (driver string, dsn string, defined bool)
GetStorageDriver looks up for a storage driver/dsn definition It may find databases/[(services/{serviceName}/storage)|{serviceName}|default]
func GetTLSClientConfig ¶
GetTLSClientConfig returns the configuration ssl for a server handler.
func GetTLSServerConfig ¶
GetTLSServerConfig returns the configuration ssl for a server handler
func GetUpdatesConfigs ¶
GetUpdatesConfigs gather update configs from correct location
func HasDatabase ¶
HasDatabase checks if DB key is set
func IndexServiceTableNames ¶
IndexServiceTableNames returns table names for indexes
func IsRestEditable ¶
IsRestEditable checks if the given path is allowed to be read/written via the REST API.
func ListMinioConfigsFromConfig ¶
func ListMinioConfigsFromConfig(ctx context.Context, skipSecret ...bool) map[string]*object.MinioConfig
ListMinioConfigsFromConfig scans configs for objects services configs
func ListSourcesFromConfig ¶
func ListSourcesFromConfig(ctx context.Context) map[string]*object.DataSource
ListSourcesFromConfig scans configs for sync services configs
func MinioConfigNamesToConfig ¶
func MinioConfigNamesToConfig(ctx context.Context, sources map[string]*object.MinioConfig)
MinioConfigNamesToConfig saves objects sources to config
func PoolFromURL ¶
func ReferencePoolOptionsFromURL ¶
ReferencePoolOptionsFromURL returns the options needed to set multiple reference pool in a config wrappedStore based on the wrappedStore url
eg. for a url mem://?pools=(urlencoded:rp=file:///tmp/example.json) it will open the config file:///tmp/example.json every time the reference pool rp is mentionned in the mem:// wrappedStore
func RegisterCustomValueDiffer ¶
func RegisterCustomValueDiffer(differ diff.ValueDiffer)
func RegisterExposedConfigs ¶
func RegisterExposedConfigs(serviceName string, form common.XMLSerializableForm)
RegisterExposedConfigs let services register specific forms for configs editions Used by discovery service
func RegisterProxy ¶
func RegisterProxy(key string, interceptors ...interface{})
func RegisterRestEditablePath ¶
func RegisterRestEditablePath(segments ...string)
RegisterRestEditablePath registers a config path that can be exposed and modified via the REST API
func RegisterVaultKey ¶
func RegisterVaultKey(s ...string)
RegisterVaultKey adds a key to the configuration so that the value associated with the key is swapped to an encrypted value
func ResetTlsConfigs ¶
func ResetTlsConfigs()
func SetDatabase ¶
func SetDatabase(ctx context.Context, key string, driver string, dsn string, defaultsKey string) error
SetDatabase adds a database entry, plus an optional reference in the defaults
func SourceNamesFiltered ¶
SourceNamesFiltered excludes the timestamp key from a slice of source names
func SourceNamesForDataServices ¶
SourceNamesForDataServices list sourceNames from the config, excluding the timestamp key
func SourceNamesFromDataConfigs ¶
SourceNamesFromDataConfigs list sourceNames from the config, excluding the timestamp key
func SourceNamesToConfig ¶
func SourceNamesToConfig(ctx context.Context, sources map[string]*object.DataSource)
SourceNamesToConfig saves index and sync sources to configs
func TouchSourceNamesForDataServices ¶
TouchSourceNamesForDataServices update the timestamp set with the source list
func UnusedMinioServers ¶
func UnusedMinioServers(minios map[string]*object.MinioConfig, sources map[string]*object.DataSource) []string
UnusedMinioServers searches for existing minio configs that are not used anywhere in datasources
func WatchCombined ¶
func WatchCombined(ctx context.Context, paths [][]string, opts ...watch.WatchOption) (watch.Receiver, error)
WatchCombined watches for different config paths
Types ¶
type DistributedStore ¶
type ProxyDeleter ¶
type ProxySetter ¶
type RevisionsProvider ¶
type RevisionsProvider interface {
AsRevisionsStore(...RevisionsStoreOption) (Store, revisions.Store)
}
type RevisionsStoreOption ¶
type RevisionsStoreOption func(o *RevisionsStoreOptions)
func WithDebounce ¶
func WithDebounce(d time.Duration) RevisionsStoreOption
type RevisionsStoreOptions ¶
type Store ¶
type Store interface { configx.Storer watch.Watcher As(out any) bool Close(ctx context.Context) error Done() <-chan struct{} Saver sync.Locker }
Store defines the functionality a config must provide
func NewStoreWithReferencePool ¶
NewStoreWithReferencePool creates a new store
func NewVault ¶
NewVault creates a new vault with a standard config wrappedStore and a vault wrappedStore
func NewVersionStore ¶
NewVersionStore based on a file Version Store and a wrappedStore
func OpenStore ¶
OpenStore opens the Store identified by the URL given. See the URLOpener documentation in driver subpackages for details on supported URL formats, and https://gocloud.dev/concepts/urls for more information.
type URLMux ¶
type URLMux struct {
// contains filtered or unexported fields
}
URLMux is a URL opener multiplexer. It matches the scheme of the URLs against a set of registered schemes and calls the opener that matches the URL's scheme. See https://gocloud.dev/concepts/urls/ for more information.
The zero value is a multiplexer with no registered schemes.
func DefaultURLMux ¶
func DefaultURLMux() *URLMux
DefaultURLMux returns the URLMux used by OpenTopic and OpenSubscription.
Driver packages can use this to register their TopicURLOpener and/or SubscriptionURLOpener on the mux.
func (*URLMux) OpenStore ¶
OpenStore calls OpenURL with the URL parsed from urlstr. OpenStore is safe to call from multiple goroutines.
func (*URLMux) Register ¶
Register registers the opener with the given scheme. If an opener already exists for the scheme, Register panics.
func (*URLMux) ValidScheme ¶
ValidScheme returns true if scheme has been registered.