conf

package
v2.0.0-alpha1+incompat... Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2019 License: BSD-2-Clause Imports: 11 Imported by: 33

Documentation

Overview

Package conf parses start up args and config file

Index

Constants

This section is empty.

Variables

View Source
var (
	// Admin
	ADMIN_EMAIL string
	ADMIN_USERS string
	AdminUsers  []string

	// Permissions for anonymous user
	ANON_READ   bool
	ANON_WRITE  bool
	ANON_DELETE bool

	// Address
	API_IP   string
	API_PORT int
	API_URL  string // for external address only

	// Auth
	AUTH_BASIC              bool
	AUTH_GLOBUS_TOKEN_URL   string
	AUTH_GLOBUS_PROFILE_URL string
	AUTH_OAUTH_URL_STR      string
	AUTH_OAUTH_BEARER_STR   string
	AUTH_CACHE_TIMEOUT      int
	AUTH_OAUTH              = make(map[string]string)
	OAUTH_DEFAULT           string // first value in AUTH_OAUTH_URL_STR

	// Default Chunksize for size virtual index
	CHUNK_SIZE int64 = 1048576

	// Config File
	CONFIG_FILE string

	// Runtime
	EXPIRE_WAIT   int // wait time for reaper in minutes
	GOMAXPROCS    string
	MAX_REVISIONS int // max number of node revisions to keep; values < 0 mean keep all

	// Logs
	LOG_PERF    bool // Indicates whether performance logs should be stored
	LOG_ROTATE  bool // Indicates whether logs should be rotated daily
	LOG_OUTPUT  string
	LOG_TRACE   bool // enable trace logging
	DEBUG_LEVEL int
	DEBUG_AUTH  bool // set this to disable auth checking in most functions

	// Mongo information
	MONGODB_HOSTS             string
	MONGODB_DATABASE          string
	MONGODB_USER              string
	MONGODB_PASSWORD          string
	MONGODB_ATTRIBUTE_INDEXES string

	// Node Indices
	NODE_IDXS map[string]idxOpts = nil

	// Paths
	PATH_SITE    string
	PATH_DATA    string
	PATH_LOGS    string
	PATH_LOCAL   string
	PATH_PIDFILE string

	// Reload
	RELOAD string

	// SSL
	SSL      bool
	SSL_KEY  string
	SSL_CERT string

	FORCE_YES    bool
	PRINT_HELP   bool // full usage
	SHOW_HELP    bool // simple usage
	SHOW_VERSION bool

	// change behavior of system from cache to backend store
	//IS_CACHE   bool   //
	PATH_CACHE        string //   path to cache directory, default is PATH_DATA
	MIN_REPLICA_COUNT int    // minimum number of Locations required before enabling delete of local file in DATA_PATH
	CACHE_TTL         int    // time in hours for cache items to be retained
	NODE_MIGRATION    bool   // if true shock server will attempt to migrate data to remote Locations (see locations.yaml)
	NODE_DATA_REMOVAL bool   // if true shock server will attempt to remove local if at least MIN_REPLICA_COUNT copies exist

	// internal config control
	FAKE_VAR = false
)
View Source
var LOG_OUTPUTS = [3]string{"file", "console", "both"}
View Source
var LocationsMap map[string]*LocationConfig

LocationsMap allow access to Location objects via Locations("ID")

View Source
var TypesMap map[string]*TypeConfig

TypesMap allow access to all types via Types("ID")

View Source
var VERSION string

const VERSION string = "[% VERSION %]"

View Source
var VERSIONS = map[string]int{
	"ACL":  2,
	"Auth": 1,
	"Node": 4,
}

Functions

func Bool

func Bool(s string) bool

Bool is a convenience wrapper around strconv.ParseBool

func Initialize

func Initialize() (err error)

Initialize is an explicit init. Enables outside use of shock-server packages. Parses config and populates the conf variables.

func Print

func Print()

Print prints the configuration loads to stdout

Types

type AzureLocation

type AzureLocation struct {
	Account   string `bson:"Account" json:"-" yaml:"Account" `             // e.g.g Account name
	Container string `bson:"Container" json:"Container" yaml:"Container" ` // e.g.g Azure ContainerName
}

AzureLocation Microsoft Azure specific fields

type Config

type Config struct {
	Locations []LocationConfig `bson:"Locations" json:"Locations" yaml:"Locations" `
}

Config contains an array of Location objects

type Config_store added in v0.9.22

type Config_store struct {
	Store []*Config_value
	Fs    *flag.FlagSet
	Con   *config.Config
}

func NewCS added in v0.9.22

func NewCS(c *config.Config) *Config_store

func (*Config_store) AddBool added in v0.9.22

func (this *Config_store) AddBool(target *bool,
	default_value bool,
	section string,
	key string,
	descr_short string,
	descr_long string)

func (*Config_store) AddInt added in v0.9.22

func (this *Config_store) AddInt(target *int,
	default_value int,
	section string,
	key string,
	descr_short string,
	descr_long string)

func (*Config_store) AddString added in v0.9.22

func (this *Config_store) AddString(target *string,
	default_value string,
	section string,
	key string,
	descr_short string,
	descr_long string)

func (Config_store) Parse added in v0.9.22

func (this Config_store) Parse()

func (Config_store) PrintHelp added in v0.9.22

func (this Config_store) PrintHelp()

type Config_value added in v0.9.22

type Config_value struct {
	Conf_type string
	Conf_str  *Config_value_string
	Conf_int  *Config_value_int
	Conf_bool *Config_value_bool
}

type Config_value_bool added in v0.9.22

type Config_value_bool struct {
	Target        *bool
	Default_value bool
	Section       string
	Key           string
	Descr_short   string
	Descr_long    string
}

type Config_value_int added in v0.9.22

type Config_value_int struct {
	Target        *int
	Default_value int
	Section       string
	Key           string
	Descr_short   string
	Descr_long    string
}

type Config_value_string added in v0.9.22

type Config_value_string struct {
	Target        *string
	Default_value string
	Section       string
	Key           string
	Descr_short   string
	Descr_long    string
}

type GCloudLocation

type GCloudLocation struct {
	Project string `bson:"Project" json:"-" yaml:"Project" `
}

GCloudLocation specific fields

type LocationConfig

type LocationConfig struct {
	ID          string `bson:"ID" json:"ID" yaml:"ID" `                           // e.g. ANLs3 or local for local store
	Description string `bson:"Description" json:"Description" yaml:"Description"` // e.g. ANL official S3 service
	Type        string `bson:"type" json:"type" yaml:"Type" `                     // e.g. S3
	URL         string `bson:"url" json:"url" yaml:"URL"`                         // e.g. http://s3api.invalid.org/download&id=
	Token       string `bson:"token" json:"-" yaml:"Token" `                      // e.g.  Key or password
	Prefix      string `bson:"prefix" json:"-" yaml:"Prefix"`                     // e.g. any prefix needed
	AuthKey     string `bson:"AuthKey" json:"-" yaml:"AuthKey"`                   // e.g. AWS auth-key
	Persistent  bool   `bson:"persistent" json:"persistent" yaml:"Persistent"`    // e.g. is this a valid long term storage location
	Priority    int    `bson:"priority" json:"priority" yaml:"Priority"`          // e.g. f priority for pushing files upstream to this location, 0 is lowest, 100 highest
	MinPriority int    `bson:"minpriority" json:"minpriority" yaml:"MinPriority"` // e.g. minimum node priority level for this location (e.g. some stores will only handle non temporary files or high value files)
	Tier        int    `bson:"tier" json:"tier" yaml:"Tier"`                      // e.g. class or tier 0= cache, 3=ssd based backend, 5=disk based backend, 10=tape archive
	Cost        int    `bson:"cost" json:"cost" yaml:"Cost"`                      // e.g.  cost per GB for this store, default=0
	SecretKey   string `bson:"SecretKey" json:"-" yaml:"SecretKey" `              // e.g.g AWS secret-key
	Bucket      string `bson:"bucket" json:"bucket" yaml:"Bucket" `               // for AWS and GCloud

	S3Location     `bson:",inline" json:",inline" yaml:",inline"` // extensions specific to S3
	AzureLocation  `bson:",inline" json:",inline" yaml:",inline"` // extensions specific to Microsoft Azure
	TSMLocation    `bson:",inline" json:",inline" yaml:",inline"` // extension sspecific to IBM TSM
	GCloudLocation `bson:",inline" json:",inline" yaml:",inline"` // extension sspecific to IBM TSM

}

Location set of storage locations

type S3Location

type S3Location struct {
	Region string `bson:"region" json:"region" yaml:"Region" `
}

S3Location S3 specific fields

type TConfig

type TConfig struct {
	Types []TypeConfig `bson:"Types" json:"Types" yaml:"Types" `
}

TypesConfig contains an array of Type objects

type TSMLocation

type TSMLocation struct {
	Recoverycommand string `bson:"recoverycommand" json:"recoverycommand" yaml:"Recoverycommand" `
}

TSMLocation IBM TSM specific fields

type TypeConfig

type TypeConfig struct {
	ID          string `bson:"id" json:"id" yaml:"ID" `                           // e.g. default or Image or Backup
	Description string `bson:"description" json:"description" yaml:"Description"` // e.g. some description
	Priority    int    `bson:"priority" json:"priority" yaml:"Priority"`          // e.g. location priority for pushing files upstream to remote locations, 0 is lowest, 100 highest
}

types Config

Jump to

Keyboard shortcuts

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