config

package
v0.0.0-...-c5e0fe0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const APP_NAME string = "fson"

Variables

View Source
var (
	ErrConfigNotInit = errors.New("config not initialized yet")
)

Functions

func Setup

func Setup() error

Types

type AuthConfig

type AuthConfig struct {
	UpdatedAt           time.Time     `json:"updatedAt"`
	CreatedAt           time.Time     `json:"createdAt"`
	TokensExpiresAfter  time.Duration `json:"tokensExpiresAfter"`
	TokenExpireTolerant time.Duration `json:"tokenExpireTolerant"`
	Secret              string        `json:"secret"`
	AdminSecret         string        `json:"adminSecret"`
	// contains filtered or unexported fields
}

func (*AuthConfig) FilePath

func (ac *AuthConfig) FilePath() string

func (*AuthConfig) UpdateFrom

func (ac *AuthConfig) UpdateFrom(uc *AuthConfigUpdate) *AuthConfig

Updates current config with given config update. Updates config if values are not same.

type AuthConfigUpdate

type AuthConfigUpdate struct {
	Expire         *time.Duration
	ExpireTolerant *time.Duration
}

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config struct is designed to manipule how this applications works.

func Instance

func Instance() *Config

A single initialized instance of Config

func (*Config) GetAuth

func (c *Config) GetAuth() *AuthConfig

Get Auth Config.

func (*Config) GetTransfer

func (c *Config) GetTransfer() *TransferConfig

Get Transfer Config.

func (*Config) JoinConfigDir

func (c *Config) JoinConfigDir(name string) string

func (*Config) JoinDebugDir

func (c *Config) JoinDebugDir(name string) string

func (*Config) JoinLibDir

func (c *Config) JoinLibDir(name string) string

func (*Config) JoinLogDir

func (c *Config) JoinLogDir(name string) string

func (*Config) UpdateAuth

func (c *Config) UpdateAuth(u *AuthConfigUpdate) (*AuthConfig, state.Error)

If pointer to update is nil return State with StatusFailUpdate.

func (*Config) UpdateTransfer

func (c *Config) UpdateTransfer(u *TransferConfigUpdate) (*TransferConfig, state.Error)

If pointer to update is nil return State with StatusFailUpdate.

type TransferConfig

type TransferConfig struct {
	UpdatedAt time.Time      `json:"updatedAt"`
	CreatedAt time.Time      `json:"createdAt"`
	AutoStart bool           `json:"autoStart"`
	UploadDir string         `json:"uploadDir"`
	TempDir   string         `json:"tempDir"`
	Transfer  []TransferPath `json:"transfer"`
	// contains filtered or unexported fields
}

func (*TransferConfig) FilePath

func (tc *TransferConfig) FilePath() string

func (*TransferConfig) UpdateFrom

func (tc *TransferConfig) UpdateFrom(uc *TransferConfigUpdate) *TransferConfig

type TransferConfigUpdate

type TransferConfigUpdate struct {
	AutoStart *bool           `json:"autoStart"`
	UploadDir *string         `json:"uploadDir"`
	TempDir   *string         `json:"tempDir"`
	Transfer  *[]TransferPath `json:"transfer"`
}

type TransferPath

type TransferPath struct {
	Id   string `json:"id"`
	Path string `json:"path"`
}

Jump to

Keyboard shortcuts

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