config

package
v0.0.0-...-412bf38 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// DefaultConfigName is the default config file name.
	DefaultConfigName = "herald-config"

	// DefaultConfigType of file for the config file.
	DefaultConfigType = "json"

	// DefaultConfigDir is the default location for the config file.
	DefaultConfigDir = getHome()

	// DefaultConfigPath for the config file.
	DefaultConfigPath = fmt.Sprintf("%s/%s.%s", DefaultConfigDir, DefaultConfigName, DefaultConfigType)

	// DefaultServerlog file path.
	DefaultServerlog = fmt.Sprintf("%s/herald-server.log", DefaultConfigDir)

	// DefaultManifestURL for the ARTIC primer schemes.
	DefaultManifestURL = "https://raw.githubusercontent.com/artic-network/primer-schemes/master/schemes_manifest.json"

	// ErrInvalidPath is used when the config file path is bad or doesn't exist.
	ErrInvalidPath = fmt.Errorf("invalid config filepath")

	// DefaultConfig is the basic info, filled on first run of Herald.
	DefaultConfig = &Config{
		Filepath:         DefaultConfigPath,
		Fileformat:       DefaultConfigType,
		User:             &User{},
		Version:          version.VERSION,
		Serverlog:        DefaultServerlog,
		ArticManifestURL: DefaultManifestURL,
	}
)
View Source
var File_herald_config_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Config

type Config struct {
	Created          *timestamp.Timestamp `protobuf:"bytes,1,opt,name=created,proto3" json:"created,omitempty"`
	Filepath         string               `protobuf:"bytes,2,opt,name=filepath,proto3" json:"filepath,omitempty"`                 // filepath to config
	Fileformat       string               `protobuf:"bytes,3,opt,name=fileformat,proto3" json:"fileformat,omitempty"`             // the fileformat of the config on disk
	Version          string               `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"`                   // version of Herald used
	User             *User                `protobuf:"bytes,5,opt,name=user,proto3" json:"user,omitempty"`                         // user details
	Serverlog        string               `protobuf:"bytes,6,opt,name=serverlog,proto3" json:"serverlog,omitempty"`               // filepath to logfile
	ArticManifestURL string               `protobuf:"bytes,7,opt,name=articManifestURL,proto3" json:"articManifestURL,omitempty"` // url of the ARTIC manifest for primer schemes
	// contains filtered or unexported fields
}

Config is used to describe a Herald instance.

func InitConfig

func InitConfig(configDir string) (*Config, error)

InitConfig reads in the config file or generates a new one if not found.

It will return a pointer to a copy of the config in memory.

NOTE: any updates to the returned config will need to be written back to the file on disk by the user.

func (*Config) Descriptor deprecated

func (*Config) Descriptor() ([]byte, []int)

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetArticManifestURL

func (x *Config) GetArticManifestURL() string

func (*Config) GetCreated

func (x *Config) GetCreated() *timestamp.Timestamp

func (*Config) GetFileformat

func (x *Config) GetFileformat() string

func (*Config) GetFilepath

func (x *Config) GetFilepath() string

func (*Config) GetJSONDump

func (config *Config) GetJSONDump() string

GetJSONDump returns a string dump of the config in JSON

func (*Config) GetServerlog

func (x *Config) GetServerlog() string

func (*Config) GetUser

func (x *Config) GetUser() *User

func (*Config) GetVersion

func (x *Config) GetVersion() string

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

func (x *Config) ProtoReflect() protoreflect.Message

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

func (*Config) Write

func (config *Config) Write() error

Write will write a Config to disk.

type User

type User struct {
	Created *timestamp.Timestamp `protobuf:"bytes,1,opt,name=created,proto3" json:"created,omitempty"`
	Name    string               `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Email   string               `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
	// contains filtered or unexported fields
}

User is used to identify the owner of HeraldData.

func (*User) Descriptor deprecated

func (*User) Descriptor() ([]byte, []int)

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetCreated

func (x *User) GetCreated() *timestamp.Timestamp

func (*User) GetEmail

func (x *User) GetEmail() string

func (*User) GetName

func (x *User) GetName() string

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) ProtoReflect

func (x *User) ProtoReflect() protoreflect.Message

func (*User) Reset

func (x *User) Reset()

func (*User) String

func (x *User) String() string

Jump to

Keyboard shortcuts

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