filemanager: Index | Files

package settings

import ""


Package Files

branding.go defaults.go dir.go settings.go storage.go

func GenerateKey Uses

func GenerateKey() ([]byte, error)

GenerateKey generates a key of 256 bits.

type AuthMethod Uses

type AuthMethod string

AuthMethod describes an authentication method.

type Branding Uses

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

Branding contains the branding settings of the app.

type Server Uses

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 Uses

func (s *Server) Clean()

Clean cleans any variables that might need cleaning.

type Settings Uses

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 Uses

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

GetRules implements rules.Provider.

func (*Settings) MakeUserDir Uses

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

MakeUserDir makes the user directory according to settings.

type Storage Uses

type Storage struct {
    // contains filtered or unexported fields

Storage is a settings storage.

func NewStorage Uses

func NewStorage(back StorageBackend) *Storage

NewStorage creates a settings storage from a backend.

func (*Storage) Get Uses

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

Get returns the settings for the current instance.

func (*Storage) GetServer Uses

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

GetServer wraps StorageBackend.GetServer.

func (*Storage) Save Uses

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

Save saves the settings for the current instance.

func (*Storage) SaveServer Uses

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

SaveServer wraps StorageBackend.SaveServer and adds some verification.

type StorageBackend Uses

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

StorageBackend is a settings storage backend.

type UserDefaults Uses

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 Uses

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

Apply applies the default options to a user.

Package settings imports 11 packages (graph). Updated 2019-07-01. Refresh now. Tools for package owners.