settings

package
Version: v2.22.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2022 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultUsersHomeBasePath = "/users"

Variables

This section is empty.

Functions

func GenerateKey

func GenerateKey() ([]byte, error)

GenerateKey generates a key of 512 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"`
	Color           string `json:"color"`
}

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"`
	EnableThumbnails      bool   `json:"enableThumbnails"`
	ResizePreview         bool   `json:"resizePreview"`
	EnableExec            bool   `json:"enableExec"`
	TypeDetectionByHeader bool   `json:"typeDetectionByHeader"`
}

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"`
	UserHomeBasePath string              `json:"userHomeBasePath"`
	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 added in v2.0.4

func (s *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"`
	SingleClick  bool              `json:"singleClick"`
	Sorting      files.Sorting     `json:"sorting"`
	Perm         users.Permissions `json:"perm"`
	Commands     []string          `json:"commands"`
	HideDotfiles bool              `json:"hideDotfiles"`
	DateFormat   bool              `json:"dateFormat"`
}

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