conf

package
v2.0.4-alpha+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2020 License: BSD-2-Clause Imports: 11 Imported by: 8 modules, 57 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
	USE_AUTH                bool

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

	// Config File
	CONFIG_FILE string
	NO_CONFIG   bool

	// 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
	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 TransitMap map[string]struct{} //bool

TransitMap Map of UUIDs that are currently handled by FMOpen download

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 GlacierLocation

type GlacierLocation struct {
	Vault string `bson:"vault" json:"vault" yaml:"Vault" `
}

GlacierLocation specific fields

type IRodsLocation

type IRodsLocation struct {
	Zone     string `bson:"Zone" json:"-" yaml:"Zone" `
	User     string `bson:"User" json:"-" yaml:"User" `
	Password string `bson:"Password" json:"-" yaml:"Password" `
	Hostname string `bson:"Hostname" json:"-" yaml:"Hostname" `
	Port     int    `bson:"Port" json:"-" yaml:"Port" `
}

IRodsLocation specific fields

type LocationConfig

type LocationConfig struct {
	ID          string `bson:"ID" json:"ID" yaml:"ID" `                           // e.g. ANLs3 or local for local store
	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
	Description string `bson:"Description" json:"Description" yaml:"Description"` // e.g. ANL official S3 service
	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
	Region      string `bson:"region" json:"region" yaml:"Region" `

	AzureLocation   `bson:",inline" json:",inline" yaml:",inline"` // extensions specific to Microsoft Azure
	GCloudLocation  `bson:",inline" json:",inline" yaml:",inline"` // extension sspecific to IBM TSM
	IRodsLocation   `bson:",inline" json:",inline" yaml:",inline"` // extension sspecific to IRods
	GlacierLocation `bson:",inline" json:",inline" yaml:",inline"` // extension sspecific to Glacier
}

Location set of storage locations

type TConfig

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

TypesConfig contains an array of Type objects

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