config

package
v2.2.0-rc0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Overview

Package config provides tools for managing configurations

Index

Constants

View Source
const DefaultOAuthClientID = "cells-frontend"

Variables

View Source
var (
	DefaultCaUrl        = "https://acme-v02.api.letsencrypt.org/directory"
	DefaultCaStagingUrl = "https://acme-staging-v02.api.letsencrypt.org/directory"
)
View Source
var (
	PydioConfigDir  = ApplicationWorkingDir()
	PydioConfigFile = "pydio.json"

	VersionsStore filex.VersionsStore
)
View Source
var (
	DefaultBindingSite = &install.ProxyConfig{
		Binds:       []string{"0.0.0.0:8080"},
		TLSConfig:   &install.ProxyConfig_SelfSigned{SelfSigned: &install.TLSSelfSigned{}},
		SSLRedirect: false,
	}
)
View Source
var SampleConfig = `{
	"version": "` + common.Version().String() + `",
	"defaults": {
		"update": {
			"publicKey": "` + common.UpdateDefaultPublicKey + `",
			"updateUrl": "` + common.UpdateDefaultServerUrl + `"
		}
	},
    "ports":{
        "nats": 4222
    },
    "frontend":{
        "secureHeaders":{
			"X-XSS-Protection": "1; mode=block"
		},
        "plugin": {
            "editor.libreoffice": {
                "LIBREOFFICE_HOST": "localhost",
                "LIBREOFFICE_PORT": "9980",
                "LIBREOFFICE_SSL": true
            }
        }
    },
    "services":{
        "pydio.grpc.config":{
            "dsn": "default"
        },
        "pydio.grpc.user":{
            "dsn": "default",
            "tables":{
                "tree": "idm_user_tree",
                "nodes":"idm_user_nodes",
                "roles":"idm_user_roles",
                "attributes":"idm_user_attributes"
            }
        },
		"pydio.grpc.mailer": {
			"queue": {
				"@value": "boltdb"
			},
			"sender": {
				"@value": "smtp",
				"host": "my.smtp.server",
				"password": "",
				"port": 465,
				"user": "name"
			}
		},
        "pydio.grpc.role":{
            "dsn": "default"
        },
        "pydio.grpc.workspace":{
            "dsn": "default"
        },
        "pydio.grpc.acl":{
            "dsn": "default"
        },
        "pydio.grpc.tree":{
            "dsn":"default"
        },
        "pydio.grpc.meta":{
            "dsn":"default"
        },
        "pydio.thumbs_store":{
            "datasource" : "default",
            "bucket"     : "thumbs"
        },
        "pydio.docstore-binaries":{
            "datasource" : "default",
            "bucket"     : "binaries"
        },
        "pydio.versions-store":{
            "datasource" : "default",
            "bucket"     : "versions"
        },
        "pydio.grpc.search": {
            "indexContent": false
        },
		"pydio.grpc.policy": {
			"dsn": "databaseParseTime"
		},
        "pydio.grpc.data-key": {
            "dsn": "default"
        },
        "pydio.grpc.user-key": {
            "dsn": "default"
        },
        "pydio.grpc.changes": {
            "dsn": "default"
        },
		"pydio.grpc.update" : {
			"channel": "` + common.UpdateDefaultChannel + `"
		},
		"pydio.grpc.user-meta": {
			"dsn": "default"
		},
        "pydio.grpc.tasks": {
            "fork": true
        },
		"pydio.web.oauth":{
			"connectors": [
				{
					"type": "pydio",
					"id"  : "pydio",
					"name": "Pydio Cells"
				}
			],
			"cors": {
				"public": {
					"allowedOrigins": "*"
				}
			},
			"staticClients": [
                {
					"client_id": "` + DefaultOAuthClientID + `",
					"client_name": "CellsFrontend Application",
					"revokeRefreshTokenAfterInactivity": "2h",
					"grant_types": [
						"authorization_code", 
						"refresh_token"
					],
					"redirect_uris": [
						"#default_bind#/auth/callback"
                    ],
                    "post_logout_redirect_uris": [
                        "#default_bind#/auth/logout"
                    ],
					"response_types": ["code", "token", "id_token"],
					"scope": "openid email profile pydio offline"
				},
				{
					"client_id": "cells-sync",
					"client_name": "CellsSync Application",
					"grant_types": [
						"authorization_code", 
						"refresh_token"
					],
					"redirect_uris": [
						"http://localhost:3000/servers/callback",
						"http://localhost:[3636-3666]/servers/callback"
					],
					"response_types": ["code", "token", "id_token"],
					"scope": "openid email profile pydio offline"
				},
				{
					"client_id": "cells-client",
					"client_name": "Cells Client CLI Tool",
					"grant_types": [
						"authorization_code",
						"refresh_token"
					],
					"redirect_uris": [
						"http://localhost:3000/servers/callback",
						"#binds...#/oauth2/oob"
					],
					"response_types": [
						"code",
						"token",
						"id_token"
					],
					"scope": "openid email profile pydio offline"
				},
				{
					"client_id": "cells-mobile",
					"client_name": "Mobile Applications",
					"grant_types": [
						"authorization_code",
						"refresh_token"
					],
					"redirect_uris": [
						"cellsauth://callback"
					],
					"response_types": [
						"code",
						"token",
						"id_token"
					],
					"scope": "openid email profile pydio offline"
				}
			]
		}
    }
}`

Functions

func ApplicationWorkingDir

func ApplicationWorkingDir(dirType ...ApplicationDirType) string

ApplicationWorkingDir creates a local file to store pydio system data

func AsTestEnv

func AsTestEnv()

func Del

func Del(path ...string)

Del value at a certain path

func DelSecret added in v1.2.2

func DelSecret(uuid string)

func ExposedConfigsForService added in v1.2.2

func ExposedConfigsForService(serviceName string) common.XMLSerializableForm

ExposedConfigsForService returns exposed configs for service

func FactorizeMinioServers added in v1.2.2

func FactorizeMinioServers(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 Get

func Get(path ...string) configx.Values

Get access to the underlying structure at a certain path

func GetDatabase

func GetDatabase(key string) (string, string)

GetDatabase retrieves the database data from the config

func GetDefaultSiteURL

func GetDefaultSiteURL(sites ...*install.ProxyConfig) string

GetDefaultSiteURL returns the first available bindURL of all available sites

func GetJsonPath added in v1.0.1

func GetJsonPath() string

GetJsonPath build path for json that contain the local config

func GetRemoteSource added in v1.2.2

func GetRemoteSource() bool

func GetSecret added in v1.2.2

func GetSecret(uuid string) configx.Values

func GetSitesAllowedHostnames

func GetSitesAllowedHostnames() map[string]string

GetSitesAllowedHostnames returns a map of hostname => url for all sites. TODO : this function could switch to a list of specific authorized hostnames

func GetTLSClientConfig added in v1.2.2

func GetTLSClientConfig(t string) *tls.Config

GetTLSClientConfig returns the configuration ssl for a server handler.

func GetTLSServerConfig added in v1.2.2

func GetTLSServerConfig(t string) *tls.Config

GetTLSServerConfig returns the configuration ssl for a server handler

func GetUpdatesConfigs

func GetUpdatesConfigs() configx.Values

GetUpdatesConfigs gather update configs from correct location

func IndexServiceTableNames added in v1.2.2

func IndexServiceTableNames(dsName string) map[string]string

func ListMinioConfigsFromConfig added in v1.2.2

func ListMinioConfigsFromConfig() map[string]*object.MinioConfig

ListMinioConfigsFromConfig scans configs for objects services configs

func ListSourcesFromConfig added in v1.2.2

func ListSourcesFromConfig() map[string]*object.DataSource

ListSourcesFromConfig scans configs for sync services configs

func LoadSites

func LoadSites(configOnly ...bool) ([]*install.ProxyConfig, error)

LoadSites returns all sites defined by order of preference : - ENV VARS - YAML CONFIG - INTERNAL CONFIG - If none is found, returns a default value If configOnly is set to true, will only return the ones saved in configs

func MinioConfigNamesToConfig added in v1.2.2

func MinioConfigNamesToConfig(sources map[string]*object.MinioConfig)

MinioConfigNamesToConfig saves objects sources to config

func NewKeyForSecret added in v1.2.2

func NewKeyForSecret() string

func NewVersionStore

func NewVersionStore(vs filex.VersionsStore, store configx.Entrypoint) configx.Entrypoint

func OnInitialized

func OnInitialized(f func())

func Register

func Register(store Store)

func RegisterExposedConfigs added in v1.2.2

func RegisterExposedConfigs(serviceName string, form common.XMLSerializableForm)

RegisterExposedConfigs let services register specific forms for configs editions Used by discovery service

func RegisterVault

func RegisterVault(store Store)

func RegisterVaultKey added in v1.2.2

func RegisterVaultKey(s ...string)

func ResetTlsConfigs

func ResetTlsConfigs()

func Save added in v1.0.1

func Save(ctxUser string, ctxMessage string) error

Save the config in the hard store

func SaveSites

func SaveSites(sites []*install.ProxyConfig, user, msg string) error

SaveSites saves a list of sites inside configuration

func ServiceDataDir

func ServiceDataDir(serviceName string) (string, error)

ServiceDataDir returns the applicationdir/services/serviceName and creates it if it does not exists

func Set

func Set(val interface{}, path ...string) error

Set new values at a certain path

func SetSecret added in v1.2.2

func SetSecret(uuid string, val string)

func SourceNamesFiltered added in v1.2.4

func SourceNamesFiltered(names []string) []string

SourceNamesForDataServices excludes the timestamp key from a slice of source names

func SourceNamesForDataServices added in v1.2.4

func SourceNamesForDataServices(dataSrvType string) []string

SourceNamesForDataServices list sourceNames from the config, excluding the timestamp key

func SourceNamesFromDataConfigs added in v1.2.4

func SourceNamesFromDataConfigs(values configx.Values) []string

SourceNamesForDataServices list sourceNames from the config, excluding the timestamp key

func SourceNamesToConfig added in v1.2.2

func SourceNamesToConfig(sources map[string]*object.DataSource)

SourceNamesToConfig saves index and sync sources to configs

func TouchSourceNamesForDataServices added in v1.2.4

func TouchSourceNamesForDataServices(dataSrvType string)

func UnusedMinioServers added in v1.2.2

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 Vault added in v1.2.2

func Vault() configx.Entrypoint

func Watch added in v1.2.2

func Watch(path ...string) (configx.Receiver, error)

Watch for config changes for a specific path or underneath

Types

type ApplicationDirType

type ApplicationDirType int
const (
	ApplicationDirData ApplicationDirType = iota
	ApplicationDirLogs
	ApplicationDirServices
)

type Store

type Store interface {
	configx.Entrypoint

	configx.Watcher

	// Save with context
	Save(string, string) error // Should we not do it in a function ?
}

func New

func New(store configx.Entrypoint) Store

New creates a configuration provider with in-memory access

func NewVault

func NewVault(configStore Store, vaultStore Store) Store

type Watcher

type Watcher interface {
	Next() (*micro.ChangeSet, error)
	Stop()
}

Directories

Path Synopsis
envvar
Package envvar implements Pydio specific interface for dynamic configurations that are backed by OS environment variables.
Package envvar implements Pydio specific interface for dynamic configurations that are backed by OS environment variables.
remote
Package source implements a configuration client backed by a config server
Package source implements a configuration client backed by a config server

Jump to

Keyboard shortcuts

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