settings

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthUser

type AuthUser struct {
	Username    string `json:"username"`    // User username for authentication
	Password    string `json:"password"`    // User password for authentication
	AllowFTP    bool   `json:"allowFTP"`    // Can user use the ftp server
	AllowHTTP   bool   `json:"allowHTTP"`   // Can user use the http server
	AllowUpload bool   `json:"allowUpload"` // Can user upload new files
}

type Settings

type Settings struct {
	PreferredLangOrder []int    `json:"preferredLanguageOrder"` // List of language id's to use when parsing CNMT data area
	TitlesDBURLs       []string `json:"titlesDbUrls"`           // URL's to use when loading the local titledb
	FoldersToScan      []string `json:"sourceFolders"`          // Folders to look for new files in
	CacheFolder        string   `json:"cacheFolder"`            // Folder to cache downloads and other temp files, if preserved will avoid re-downloads. Can be /tmp/ though
	// Organisation
	StorageFolder       string `json:"storageFolder"`       // Where sorted files are stored to
	OrganisationFormat  string `json:"organisationFormat"`  // Organisation format string
	EnableSorting       bool   `json:"enableSorting"`       // If sorting should be performed
	CleanupEmptyFolders bool   `json:"cleanupEmptyFolders"` // Should we cleanup empty folders in the search and storage paths

	Deduplicate      bool `json:"deduplicate"`      // If we remove duplicate files for the same titleID, or old update files
	PreferXCI        bool `json:"preferXCI"`        // If when we find duplicates we pick the xci/xcz file over nsp/nsz
	PreferCompressed bool `json:"preferCompressed"` // Prefer compressed form of files on duplicate

	//Serving files
	HTTPPort      int        `json:"httpPort"`      // Port used for HTTP
	FTPPort       int        `json:"ftpPort"`       // Port used for FTP
	AllowAnonFTP  bool       `json:"allowAnonFTP"`  // Allow anon (open to public) FTP
	AllowAnonHTTP bool       `json:"allowAnonHTTP"` // Allow anon (open to public) HTTP
	Users         []AuthUser `json:"users"`         // User accounts
	JSONLocations []string   `json:"jsonLocations"` // Extra locations to add to locations field in json for backup instances
	ServerMOTD    string     `json:"serverMOTD"`    // Server title used for public facing info

	// Incoming
	UploadingAllowed bool   `json:"uploadingAllowed"` // Can FTP be used to push new files
	TempFilesFolder  string `json:"tempFilesFolder"`  // Temporary file storage location for FTP uploads

	ValidateLibrary       bool `json:"validateLibrary"`
	ValidateNewFiles      bool `json:"validateUploads"`       // If uploads must validate before being added, even if above toggles are off
	DeleteValidationFails bool `json:"deleteValidationFails"` // If a file fails validation, should it be deleted
	// Compression
	NSZCommandLine     string `json:"NSZCommandLine"`     // Base command line used to run NSZ
	CompressionEnabled bool   `json:"compressionEnabled"` // Should files be converted to their compressed verions
	// Misc
	LogLevel    int    `json:"logLevel"` // Log level, higher numbers reduce log output
	LogFilePath string `json:"logPath"`  // Path to persist logs to, if empty none are persisted
	// contains filtered or unexported fields
}

func NewSettings

func NewSettings(path string) *Settings

NewSettings creates settings with sane defaults And then loads any settings from the provided path (overwriting defaults)

func (*Settings) GetAllScanFolders

func (s *Settings) GetAllScanFolders() []string

func (*Settings) Load

func (s *Settings) Load()

func (*Settings) Save

func (s *Settings) Save()

func (*Settings) SetupLogging

func (s *Settings) SetupLogging(logoutput io.Writer)

Jump to

Keyboard shortcuts

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