config

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 6 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertGenericConfigToSpecificType added in v0.1.2

func ConvertGenericConfigToSpecificType(source interface{}, target interface{}) error

ConvertGenericConfigToSpecificType will attempt to copy generic configuration within source to a target struct that represents the specific storage configuration, represented as an interface{}. see config_test.go for example usage.

Types

type EmbeddedStoreConfig

type EmbeddedStoreConfig struct {
	Path string `mapstructure:"path"` // Path is the folder path to storage files
}

EmbeddedStoreConfig is the configuration for embedded store.

type GrafeasConfig

type GrafeasConfig struct {
	API           *ServerConfig `mapstructure:"api"`
	StorageType   string        `mapstructure:"storage_type"` // Natively supported storage types are "memstore" and "embedded"
	StorageConfig *StorageConfiguration
}

GrafeasConfig is the top-level configuration object, containing generic config + storage-specific config.

func LoadConfig

func LoadConfig(fileName string) (*GrafeasConfig, error)

LoadConfig creates a config from a YAML-file. If fileName is an empty string a default config will be returned.

type PgSQLConfig

type PgSQLConfig struct {
	Host     string `mapstructure:"host"`
	DbName   string `mapstructure:"dbname"`
	User     string `mapstructure:"user"`
	Password string `mapstructure:"password"`
	// Valid sslmodes: disable, allow, prefer, require, verify-ca, verify-full.
	// See https://www.postgresql.org/docs/current/static/libpq-connect.html for details
	SSLMode       string `mapstructure:"sslmode"`
	PaginationKey string `mapstructure:"paginationkey"`
}

TODO(#341) Move this to its own project PgSQLConfig is the configuration for PostgreSQL store.

type ServerConfig

type ServerConfig struct {
	Address            string   `mapstructure:"address"`              // Endpoint address, e.g. localhost:8080 or unix:///var/run/grafeas.sock
	CertFile           string   `mapstructure:"certfile"`             // A PEM encoded certificate file
	KeyFile            string   `mapstructure:"keyfile"`              // A PEM encoded private key file
	CAFile             string   `mapstructure:"cafile"`               // A PEM encoded CA's certificate file
	CORSAllowedOrigins []string `mapstructure:"cors_allowed_origins"` // Permitted CORS origins.
}

ServerConfig is the Grafeas server configuration.

type StorageConfiguration added in v0.1.2

type StorageConfiguration interface{}

StorageConfiguration is a generic interface as its implementation is entirely storage-specific.

Jump to

Keyboard shortcuts

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