settings

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKey

func GenerateKey() ([]byte, error)

GenerateKey generates a key of 256 bits.

Types

type AuthMethod

type AuthMethod string

AuthMethod describes an authentication method.

type Branding

type Branding struct {
	Name            string `json:"name"`
	DisableExternal bool   `json:"disableExternal"`
	Files           string `json:"files"`
	Theme           string `json:"theme"`
}

Branding contains the branding settings of the app.

type Server

type Server struct {
	Root    string `json:"root"`
	BaseURL string `json:"baseURL"`
	Socket  string `json:"socket"`
	TLSKey  string `json:"tlsKey"`
	TLSCert string `json:"tlsCert"`
	Port    string `json:"port"`
	Address string `json:"address"`
	Log     string `json:"log"`
}

Server specific settings.

func (*Server) Clean

func (s *Server) Clean()

Clean cleans any variables that might need cleaning.

type Settings

type Settings struct {
	Key           []byte              `json:"key"`
	Signup        bool                `json:"signup"`
	CreateUserDir bool                `json:"createUserDir"`
	Defaults      UserDefaults        `json:"defaults"`
	AuthMethod    AuthMethod          `json:"authMethod"`
	Branding      Branding            `json:"branding"`
	Commands      map[string][]string `json:"commands"`
	Shell         []string            `json:"shell"`
	Rules         []rules.Rule        `json:"rules"`
}

Settings contain the main settings of the application.

func (*Settings) GetRules

func (s *Settings) GetRules() []rules.Rule

GetRules implements rules.Provider.

func (*Settings) MakeUserDir

func (settings *Settings) MakeUserDir(username, userScope, serverRoot string) (string, error)

MakeUserDir makes the user directory according to settings.

type Storage

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

Storage is a settings storage.

func NewStorage

func NewStorage(back StorageBackend) *Storage

NewStorage creates a settings storage from a backend.

func (*Storage) Get

func (s *Storage) Get() (*Settings, error)

Get returns the settings for the current instance.

func (*Storage) GetServer

func (s *Storage) GetServer() (*Server, error)

GetServer wraps StorageBackend.GetServer.

func (*Storage) Save

func (s *Storage) Save(set *Settings) error

Save saves the settings for the current instance.

func (*Storage) SaveServer

func (s *Storage) SaveServer(ser *Server) error

SaveServer wraps StorageBackend.SaveServer and adds some verification.

type StorageBackend

type StorageBackend interface {
	Get() (*Settings, error)
	Save(*Settings) error
	GetServer() (*Server, error)
	SaveServer(*Server) error
}

StorageBackend is a settings storage backend.

type UserDefaults

type UserDefaults struct {
	Scope    string            `json:"scope"`
	Locale   string            `json:"locale"`
	ViewMode users.ViewMode    `json:"viewMode"`
	Sorting  files.Sorting     `json:"sorting"`
	Perm     users.Permissions `json:"perm"`
	Commands []string          `json:"commands"`
}

UserDefaults is a type that holds the default values for some fields on User.

func (*UserDefaults) Apply

func (d *UserDefaults) Apply(u *users.User)

Apply applies the default options to a user.

Jump to

Keyboard shortcuts

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