config

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Stash         = "stash"
	Cache         = "cache"
	Generated     = "generated"
	Metadata      = "metadata"
	Downloads     = "downloads"
	ApiKey        = "api_key"
	Username      = "username"
	Password      = "password"
	MaxSessionAge = "max_session_age"

	DefaultMaxSessionAge = 60 * 60 * 1 // 1 hours

	Database = "database"

	Exclude      = "exclude"
	ImageExclude = "image_exclude"

	VideoExtensions            = "video_extensions"
	ImageExtensions            = "image_extensions"
	GalleryExtensions          = "gallery_extensions"
	CreateGalleriesFromFolders = "create_galleries_from_folders"

	// CalculateMD5 is the config key used to determine if MD5 should be calculated
	// for video files.
	CalculateMD5 = "calculate_md5"

	// VideoFileNamingAlgorithm is the config key used to determine what hash
	// should be used when generating and using generated files for scenes.
	VideoFileNamingAlgorithm = "video_file_naming_algorithm"

	MaxTranscodeSize          = "max_transcode_size"
	MaxStreamingTranscodeSize = "max_streaming_transcode_size"

	ParallelTasks = "parallel_tasks"

	PreviewPreset = "preview_preset"

	PreviewAudio = "preview_audio"

	PreviewSegmentDuration = "preview_segment_duration"

	PreviewSegments = "preview_segments"

	PreviewExcludeStart = "preview_exclude_start"

	PreviewExcludeEnd = "preview_exclude_end"

	WriteImageThumbnails = "write_image_thumbnails"

	Host = "host"

	Port = "port"

	ExternalHost = "external_host"

	// key used to sign JWT tokens
	JWTSignKey = "jwt_secret_key"

	// key used for session store
	SessionStoreKey = "session_store_key"

	// scraping options
	ScrapersPath              = "scrapers_path"
	ScraperUserAgent          = "scraper_user_agent"
	ScraperCertCheck          = "scraper_cert_check"
	ScraperCDPPath            = "scraper_cdp_path"
	ScraperExcludeTagPatterns = "scraper_exclude_tag_patterns"

	// stash-box options
	StashBoxes = "stash_boxes"

	// plugin options
	PluginsPath = "plugins_path"

	// i18n
	Language = "language"

	// served directories
	// this should be manually configured only
	CustomServedFolders = "custom_served_folders"

	// UI directory. Overrides to serve the UI from a specific location
	// rather than use the embedded UI.
	CustomUILocation = "custom_ui_location"

	// Interface options
	MenuItems = "menu_items"

	SoundOnPreview = "sound_on_preview"

	WallShowTitle = "wall_show_title"

	CustomPerformerImageLocation = "custom_performer_image_location"
	MaximumLoopDuration          = "maximum_loop_duration"
	AutostartVideo               = "autostart_video"
	AutostartVideoOnPlaySelected = "autostart_video_on_play_selected"

	ContinuePlaylistDefault = "continue_playlist_default"
	ShowStudioAsText        = "show_studio_as_text"
	CSSEnabled              = "cssEnabled"

	ShowScrubber = "show_scrubber"

	WallPlayback = "wall_playback"

	SlideshowDelay = "slideshow_delay"

	DisableDropdownCreatePerformer = "disable_dropdown_create.performer"
	DisableDropdownCreateStudio    = "disable_dropdown_create.studio"
	DisableDropdownCreateTag       = "disable_dropdown_create.tag"

	HandyKey        = "handy_key"
	FunscriptOffset = "funscript_offset"

	SecurityTripwireAccessedFromPublicInternet = "security_tripwire_accessed_from_public_internet"

	// DLNA options
	DLNAServerName         = "dlna.server_name"
	DLNADefaultEnabled     = "dlna.default_enabled"
	DLNADefaultIPWhitelist = "dlna.default_whitelist"
	DLNAInterfaces         = "dlna.interfaces"

	// Logging options
	LogFile = "logFile"
	LogOut  = "logOut"

	LogLevel = "logLevel"

	LogAccess = "logAccess"

	// Default settings
	DefaultScanSettings     = "defaults.scan_task"
	DefaultIdentifySettings = "defaults.identify_task"
	DefaultAutoTagSettings  = "defaults.auto_tag_task"
	DefaultGenerateSettings = "defaults.generate_task"

	DeleteFileDefault      = "defaults.delete_file"
	DeleteGeneratedDefault = "defaults.delete_generated"

	// Desktop Integration Options
	NoBrowser                           = "noBrowser"
	NoBrowserDefault                    = false
	NotificationsEnabled                = "notifications_enabled"
	NotificationsEnabledDefault         = true
	ShowOneTimeMovedNotification        = "show_one_time_moved_notification"
	ShowOneTimeMovedNotificationDefault = false

	// File upload options
	MaxUploadSize = "max_upload_size"
)

Variables

This section is empty.

Functions

func FileEnvSet added in v0.11.0

func FileEnvSet() bool

FileEnvSet returns true if the configuration file environment parameter is set.

func IsOfficialBuild added in v0.13.0

func IsOfficialBuild() bool

Types

type Instance added in v0.7.0

type Instance struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func GetInstance added in v0.7.0

func GetInstance() *Instance

func Initialize added in v0.7.0

func Initialize() (*Instance, error)

func (*Instance) ActivatePublicAccessTripwire added in v0.10.0

func (i *Instance) ActivatePublicAccessTripwire(requestIP string) error

ActivatePublicAccessTripwire sets the security_tripwire_accessed_from_public_internet config field to the provided IP address to indicate that stash has been accessed from this public IP without authentication.

func (*Instance) FinalizeSetup added in v0.7.0

func (i *Instance) FinalizeSetup()

func (*Instance) GetAPIKey added in v0.7.0

func (i *Instance) GetAPIKey() string

func (*Instance) GetAutostartVideo added in v0.7.0

func (i *Instance) GetAutostartVideo() bool

func (*Instance) GetAutostartVideoOnPlaySelected added in v0.11.0

func (i *Instance) GetAutostartVideoOnPlaySelected() bool

func (*Instance) GetCPUProfilePath added in v0.8.0

func (i *Instance) GetCPUProfilePath() string

GetCPUProfilePath returns the path to the CPU profile file to output profiling info to. This is set only via a commandline flag. Returns an empty string if not set.

func (*Instance) GetCSS added in v0.7.0

func (i *Instance) GetCSS() string

func (*Instance) GetCSSEnabled added in v0.7.0

func (i *Instance) GetCSSEnabled() bool

func (*Instance) GetCSSPath added in v0.7.0

func (i *Instance) GetCSSPath() string

func (*Instance) GetCachePath added in v0.7.0

func (i *Instance) GetCachePath() string

func (*Instance) GetConfigFile added in v0.7.0

func (i *Instance) GetConfigFile() string

GetConfigFile returns the full path to the used configuration file.

func (*Instance) GetConfigPath added in v0.7.0

func (i *Instance) GetConfigPath() string

GetConfigPath returns the path of the directory containing the used configuration file.

func (*Instance) GetContinuePlaylistDefault added in v0.11.0

func (i *Instance) GetContinuePlaylistDefault() bool

func (*Instance) GetCreateGalleriesFromFolders added in v0.7.0

func (i *Instance) GetCreateGalleriesFromFolders() bool

func (*Instance) GetCredentials added in v0.7.0

func (i *Instance) GetCredentials() (string, string)

func (*Instance) GetCustomPerformerImageLocation added in v0.9.0

func (i *Instance) GetCustomPerformerImageLocation() string

func (*Instance) GetCustomServedFolders added in v0.7.0

func (i *Instance) GetCustomServedFolders() URLMap

GetCustomServedFolders gets the map of custom paths to their applicable filesystem locations

func (*Instance) GetCustomUILocation added in v0.7.0

func (i *Instance) GetCustomUILocation() string

func (*Instance) GetDLNADefaultEnabled added in v0.8.0

func (i *Instance) GetDLNADefaultEnabled() bool

GetDLNADefaultEnabled returns true if the DLNA is enabled by default.

func (*Instance) GetDLNADefaultIPWhitelist added in v0.8.0

func (i *Instance) GetDLNADefaultIPWhitelist() []string

GetDLNADefaultIPWhitelist returns a list of IP addresses/wildcards that are allowed to use the DLNA service.

func (*Instance) GetDLNAInterfaces added in v0.8.0

func (i *Instance) GetDLNAInterfaces() []string

GetDLNAInterfaces returns a list of interface names to expose DLNA on. If empty, runs on all interfaces.

func (*Instance) GetDLNAServerName added in v0.8.0

func (i *Instance) GetDLNAServerName() string

GetDLNAServerName returns the visible name of the DLNA server. If empty, "stash" will be used.

func (*Instance) GetDangerousAllowPublicWithoutAuth added in v0.10.0

func (i *Instance) GetDangerousAllowPublicWithoutAuth() bool

GetDangerousAllowPublicWithoutAuth determines if the security feature is enabled. See https://github.com/stashapp/stash/wiki/Authentication-Required-When-Accessing-Stash-From-the-Internet

func (*Instance) GetDatabasePath added in v0.7.0

func (i *Instance) GetDatabasePath() string

func (*Instance) GetDefaultAutoTagSettings added in v0.12.0

func (i *Instance) GetDefaultAutoTagSettings() *models.AutoTagMetadataOptions

GetDefaultAutoTagSettings returns the default Scan task settings. Returns nil if the settings could not be unmarshalled, or if it has not been set.

func (*Instance) GetDefaultDatabaseFilePath added in v0.7.0

func (i *Instance) GetDefaultDatabaseFilePath() string

GetDefaultDatabaseFilePath returns the default database filename, which is located in the same directory as the config file.

func (*Instance) GetDefaultGenerateSettings added in v0.12.0

func (i *Instance) GetDefaultGenerateSettings() *models.GenerateMetadataOptions

GetDefaultGenerateSettings returns the default Scan task settings. Returns nil if the settings could not be unmarshalled, or if it has not been set.

func (*Instance) GetDefaultIdentifySettings added in v0.11.0

func (i *Instance) GetDefaultIdentifySettings() *models.IdentifyMetadataTaskOptions

GetDefaultIdentifySettings returns the default Identify task settings. Returns nil if the settings could not be unmarshalled, or if it has not been set.

func (*Instance) GetDefaultPluginsPath added in v0.7.0

func (i *Instance) GetDefaultPluginsPath() string

func (*Instance) GetDefaultScanSettings added in v0.12.0

func (i *Instance) GetDefaultScanSettings() *models.ScanMetadataOptions

GetDefaultScanSettings returns the default Scan task settings. Returns nil if the settings could not be unmarshalled, or if it has not been set.

func (*Instance) GetDefaultScrapersPath added in v0.7.0

func (i *Instance) GetDefaultScrapersPath() string

func (*Instance) GetDeleteFileDefault added in v0.11.0

func (i *Instance) GetDeleteFileDefault() bool

func (*Instance) GetDeleteGeneratedDefault added in v0.11.0

func (i *Instance) GetDeleteGeneratedDefault() bool

func (*Instance) GetDisableDropdownCreate added in v0.11.0

func (i *Instance) GetDisableDropdownCreate() *models.ConfigDisableDropdownCreate

func (*Instance) GetExcludes added in v0.7.0

func (i *Instance) GetExcludes() []string

func (*Instance) GetExternalHost added in v0.7.0

func (i *Instance) GetExternalHost() string

func (*Instance) GetFunscriptOffset added in v0.9.0

func (i *Instance) GetFunscriptOffset() int

func (*Instance) GetGalleryExtensions added in v0.7.0

func (i *Instance) GetGalleryExtensions() []string

func (*Instance) GetGeneratedPath added in v0.7.0

func (i *Instance) GetGeneratedPath() string

func (*Instance) GetHandyKey added in v0.8.0

func (i *Instance) GetHandyKey() string

func (*Instance) GetHost added in v0.7.0

func (i *Instance) GetHost() string

func (*Instance) GetImageExcludes added in v0.7.0

func (i *Instance) GetImageExcludes() []string

func (*Instance) GetImageExtensions added in v0.7.0

func (i *Instance) GetImageExtensions() []string

func (*Instance) GetJWTSignKey added in v0.7.0

func (i *Instance) GetJWTSignKey() []byte

func (*Instance) GetLanguage added in v0.7.0

func (i *Instance) GetLanguage() string

func (*Instance) GetLogAccess added in v0.7.0

func (i *Instance) GetLogAccess() bool

GetLogAccess returns true if http requests should be logged to the terminal. HTTP requests are not logged to the log file. Defaults to true.

func (*Instance) GetLogFile added in v0.7.0

func (i *Instance) GetLogFile() string

GetLogFile returns the filename of the file to output logs to. An empty string means that file logging will be disabled.

func (*Instance) GetLogLevel added in v0.7.0

func (i *Instance) GetLogLevel() string

GetLogLevel returns the lowest log level to write to the log. Should be one of "Debug", "Info", "Warning", "Error"

func (*Instance) GetLogOut added in v0.7.0

func (i *Instance) GetLogOut() bool

GetLogOut returns true if logging should be output to the terminal in addition to writing to a log file. Logging will be output to the terminal if file logging is disabled. Defaults to true.

func (*Instance) GetMaxSessionAge added in v0.7.0

func (i *Instance) GetMaxSessionAge() int

GetMaxSessionAge gets the maximum age for session cookies, in seconds. Session cookie expiry times are refreshed every request.

func (*Instance) GetMaxStreamingTranscodeSize added in v0.7.0

func (i *Instance) GetMaxStreamingTranscodeSize() models.StreamingResolutionEnum

func (*Instance) GetMaxTranscodeSize added in v0.7.0

func (i *Instance) GetMaxTranscodeSize() models.StreamingResolutionEnum

func (*Instance) GetMaxUploadSize added in v0.7.0

func (i *Instance) GetMaxUploadSize() int64

Max allowed graphql upload size in megabytes

func (*Instance) GetMaximumLoopDuration added in v0.7.0

func (i *Instance) GetMaximumLoopDuration() int

func (*Instance) GetMenuItems added in v0.7.0

func (i *Instance) GetMenuItems() []string

Interface options

func (*Instance) GetMetadataPath added in v0.7.0

func (i *Instance) GetMetadataPath() string

func (*Instance) GetNoBrowser added in v0.11.0

func (i *Instance) GetNoBrowser() bool

func (*Instance) GetNotificationsEnabled added in v0.13.0

func (i *Instance) GetNotificationsEnabled() bool

func (*Instance) GetParallelTasks added in v0.7.0

func (i *Instance) GetParallelTasks() int

GetParallelTasks returns the number of parallel tasks that should be started by scan or generate task.

func (*Instance) GetParallelTasksWithAutoDetection added in v0.7.0

func (i *Instance) GetParallelTasksWithAutoDetection() int

func (*Instance) GetPasswordHash added in v0.7.0

func (i *Instance) GetPasswordHash() string

func (*Instance) GetPluginsPath added in v0.7.0

func (i *Instance) GetPluginsPath() string

func (*Instance) GetPort added in v0.7.0

func (i *Instance) GetPort() int

func (*Instance) GetPreviewAudio added in v0.8.0

func (i *Instance) GetPreviewAudio() bool

func (*Instance) GetPreviewExcludeEnd added in v0.7.0

func (i *Instance) GetPreviewExcludeEnd() string

GetPreviewExcludeEnd returns the configuration setting string for excluding the end of scene videos for preview generation. A float value is interpreted as the amount of seconds to exclude from the end of the video when generating previews. If the value is suffixed with a '%' character, then it is interpreted as a proportion of the total video duration.

func (*Instance) GetPreviewExcludeStart added in v0.7.0

func (i *Instance) GetPreviewExcludeStart() string

GetPreviewExcludeStart returns the configuration setting string for excluding the start of scene videos for preview generation. This can be in two possible formats. A float value is interpreted as the amount of seconds to exclude from the start of the video before it is included in the preview. If the value is suffixed with a '%' character (for example '2%'), then it is interpreted as a proportion of the total video duration.

func (*Instance) GetPreviewPreset added in v0.7.0

func (i *Instance) GetPreviewPreset() models.PreviewPreset

GetPreviewPreset returns the preset when generating previews. Defaults to Slow.

func (*Instance) GetPreviewSegmentDuration added in v0.7.0

func (i *Instance) GetPreviewSegmentDuration() float64

GetPreviewSegmentDuration returns the duration of a single segment in a scene preview file, in seconds.

func (*Instance) GetPreviewSegments added in v0.7.0

func (i *Instance) GetPreviewSegments() int

GetPreviewSegments returns the amount of segments in a scene preview file.

func (*Instance) GetScraperCDPPath added in v0.7.0

func (i *Instance) GetScraperCDPPath() string

GetScraperCDPPath gets the path to the Chrome executable or remote address to an instance of Chrome.

func (*Instance) GetScraperCertCheck added in v0.7.0

func (i *Instance) GetScraperCertCheck() bool

GetScraperCertCheck returns true if the scraper should check for insecure certificates when fetching an image or a page.

func (*Instance) GetScraperExcludeTagPatterns added in v0.9.0

func (i *Instance) GetScraperExcludeTagPatterns() []string

func (*Instance) GetScraperUserAgent added in v0.7.0

func (i *Instance) GetScraperUserAgent() string

func (*Instance) GetScrapersPath added in v0.7.0

func (i *Instance) GetScrapersPath() string

func (*Instance) GetSecurityTripwireAccessedFromPublicInternet added in v0.10.0

func (i *Instance) GetSecurityTripwireAccessedFromPublicInternet() string

GetSecurityTripwireAccessedFromPublicInternet returns a public IP address if stash has been accessed from the public internet, with no auth enabled, and DangerousAllowPublicWithoutAuth disabled. Returns an empty string otherwise.

func (*Instance) GetSessionStoreKey added in v0.7.0

func (i *Instance) GetSessionStoreKey() []byte

func (*Instance) GetShowOneTimeMovedNotification added in v0.13.0

func (i *Instance) GetShowOneTimeMovedNotification() bool

GetShowOneTimeMovedNotification shows whether a small notification to inform the user that Stash will no longer show a terminal window, and instead will be available in the tray, should be shown.

It is true when an existing system is started after upgrading, and set to false forever after it is shown.

func (*Instance) GetShowScrubber added in v0.13.0

func (i *Instance) GetShowScrubber() bool

func (*Instance) GetShowStudioAsText added in v0.7.0

func (i *Instance) GetShowStudioAsText() bool

func (*Instance) GetSlideshowDelay added in v0.7.0

func (i *Instance) GetSlideshowDelay() int

func (*Instance) GetSoundOnPreview added in v0.7.0

func (i *Instance) GetSoundOnPreview() bool

func (*Instance) GetStashBoxes added in v0.7.0

func (i *Instance) GetStashBoxes() models.StashBoxes

func (*Instance) GetStashPaths added in v0.7.0

func (i *Instance) GetStashPaths() []*models.StashConfig

GetStathPaths returns the configured stash library paths. Works opposite to the usual case - it will return the override value only if the main value is not set.

func (*Instance) GetTLSFiles added in v0.9.0

func (i *Instance) GetTLSFiles() (certFile, keyFile string)

func (*Instance) GetUsername added in v0.7.0

func (i *Instance) GetUsername() string

func (*Instance) GetVideoExtensions added in v0.7.0

func (i *Instance) GetVideoExtensions() []string

func (*Instance) GetVideoFileNamingAlgorithm added in v0.7.0

func (i *Instance) GetVideoFileNamingAlgorithm() models.HashAlgorithm

GetVideoFileNamingAlgorithm returns what hash algorithm should be used for naming generated scene video files.

func (*Instance) GetWallPlayback added in v0.7.0

func (i *Instance) GetWallPlayback() string

func (*Instance) GetWallShowTitle added in v0.7.0

func (i *Instance) GetWallShowTitle() bool

func (*Instance) HasCredentials added in v0.7.0

func (i *Instance) HasCredentials() bool

func (*Instance) HasOverride added in v0.11.0

func (i *Instance) HasOverride(key string) bool

func (*Instance) HasTLSConfig added in v0.9.0

func (i *Instance) HasTLSConfig() bool

func (*Instance) InitTLS added in v0.9.0

func (i *Instance) InitTLS()

func (*Instance) IsCalculateMD5 added in v0.7.0

func (i *Instance) IsCalculateMD5() bool

IsCalculateMD5 returns true if MD5 checksums should be generated for scene video files.

func (*Instance) IsNewSystem added in v0.7.0

func (i *Instance) IsNewSystem() bool

func (*Instance) IsWriteImageThumbnails added in v0.10.0

func (i *Instance) IsWriteImageThumbnails() bool

IsWriteImageThumbnails returns true if image thumbnails should be written to disk after generating on the fly.

func (*Instance) Set added in v0.7.0

func (i *Instance) Set(key string, value interface{})

func (*Instance) SetCSS added in v0.7.0

func (i *Instance) SetCSS(css string)

func (*Instance) SetChecksumDefaultValues added in v0.9.0

func (i *Instance) SetChecksumDefaultValues(defaultAlgorithm models.HashAlgorithm, usingMD5 bool)

func (*Instance) SetConfigFile added in v0.7.0

func (i *Instance) SetConfigFile(fn string)

func (*Instance) SetInitialConfig added in v0.7.0

func (i *Instance) SetInitialConfig() error

SetInitialConfig fills in missing required config fields

func (*Instance) SetInitialMemoryConfig added in v0.10.0

func (i *Instance) SetInitialMemoryConfig() error

SetInitialMemoryConfig fills in missing required config fields without writing the configuration

func (*Instance) SetPassword added in v0.7.0

func (i *Instance) SetPassword(value string)

func (*Instance) Validate added in v0.7.0

func (i *Instance) Validate() error

func (*Instance) ValidateCredentials added in v0.7.0

func (i *Instance) ValidateCredentials(username string, password string) bool

func (*Instance) ValidateStashBoxes added in v0.7.0

func (i *Instance) ValidateStashBoxes(boxes []*models.StashBoxInput) error

func (*Instance) Write added in v0.7.0

func (i *Instance) Write() error

type MissingConfigError added in v0.7.0

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

func (MissingConfigError) Error added in v0.7.0

func (e MissingConfigError) Error() string

type StashBoxError added in v0.11.0

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

StashBoxError represents configuration errors of Stash-Box

func (*StashBoxError) Error added in v0.11.0

func (s *StashBoxError) Error() string

type URLMap added in v0.3.0

type URLMap map[string]string

func (URLMap) GetFilesystemLocation added in v0.3.0

func (m URLMap) GetFilesystemLocation(url string) (string, string)

GetFilesystemLocation returns the adjusted URL and the filesystem location

Jump to

Keyboard shortcuts

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