config

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config provides FileBrowser-specific configuration.

Package config provides FileBrowser-specific configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteToken

func DeleteToken() error

DeleteToken removes the saved authentication token.

func LoadToken

func LoadToken() (string, error)

LoadToken loads the saved authentication token from file.

func SaveToken

func SaveToken(token string) error

SaveToken saves the authentication token to a file.

Types

type Config

type Config struct {
	sharedconfig.Config `yaml:",inline"`

	// InstanceURL is the FileBrowser server URL (e.g., "http://localhost:8080").
	InstanceURL string `yaml:"instance_url"`

	// Username is the FileBrowser username.
	Username string `yaml:"username"`

	// Password is the FileBrowser password (supports ${ENV_VAR} interpolation).
	Password string `yaml:"password"`

	// DefaultExpires is the default expiration time for shares.
	DefaultExpires int `yaml:"default_expires"`

	// DefaultUnit is the default time unit for expiration (s, m, h, d).
	DefaultUnit string `yaml:"default_unit"`
}

Config is the FileBrowser-specific configuration. It embeds the shared Config and adds FileBrowser-specific fields.

func LoadFromBytes

func LoadFromBytes(data []byte) (*Config, error)

LoadFromBytes parses a YAML config into c.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if the config is valid.

type TokenData

type TokenData struct {
	// Token is the JWT token.
	Token string `json:"token"`

	// SavedAt is when the token was saved.
	SavedAt time.Time `json:"saved_at"`

	// ExpiresAt is when the token expires (optional, from JWT).
	ExpiresAt time.Time `json:"expires_at,omitempty"`
}

TokenData represents the saved authentication token.

Jump to

Keyboard shortcuts

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