config

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PORT          = 7777
	ConfigDirName = ".beamdrop"
	// MaxUploadSize defines the maximum upload file size (100MB by default)
	MaxUploadSize int64 = 100 * 1024 * 1024 // 100MB in bytes
)

Variables

View Source
var (
	VERSION   = "0.0.1"
	Commit    = "unknown"
	BuildDate = "unknown"
)

Set via -ldflags at build time

View Source
var (
	ConfigDir  string
	ConfigPath string
	DBName     = "beamdrop.db"
	DBPath     string
	// AllowedMIMETypes defines the allowed MIME types for uploads
	// Empty list means all types are allowed
	AllowedMIMETypes = []string{

		"image/jpeg", "image/png", "image/gif", "image/webp", "image/svg+xml", "image/bmp",

		"application/pdf", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
		"application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
		"application/vnd.ms-powerpoint", "application/vnd.openxmlformats-officedocument.presentationml.presentation",
		"text/plain", "text/csv", "text/html", "text/css", "text/javascript",

		"application/zip", "application/x-rar-compressed", "application/x-7z-compressed",
		"application/x-tar", "application/gzip",

		"audio/mpeg", "audio/wav", "audio/ogg", "audio/mp4", "audio/webm", "audio/flac",

		"video/mp4", "video/mpeg", "video/webm", "video/ogg", "video/x-msvideo", "video/quicktime",

		"application/json", "application/xml", "application/javascript",

		"application/octet-stream",
	}
)
View Source
var DefaultPorts = []int{7777, 8080, 8888, 9000, 9999, 3000, 4000, 5000, 6000, 8000}

DefaultPorts is a list of ports to try if the primary port is unavailable

Functions

func CreateTrashBin

func CreateTrashBin(sharedDir string) error

CreateTrashBin creates the trash bin directory if it doesn't exist inside the sharedDir

func FindAvailablePort

func FindAvailablePort() (int, error)

FindAvailablePort tries to find an available port from the default ports list

func GetDBPath

func GetDBPath() string

func IsPortAvailable

func IsPortAvailable(port int) bool

IsPortAvailable checks if a port is available for use

func SetDBPath

func SetDBPath(path string)

Types

type Config

type Config struct {
	PORT int
}

func GetConfig

func GetConfig() Config

type Flags

type Flags struct {
	SharedDir       string
	NoQR            bool
	Port            int
	Help            bool
	Password        string
	TLSCert         string
	TLSKey          string
	AllowedOrigins  string        // Comma-separated list of allowed CORS origins
	APIAuth         bool          // Enable API key authentication for S3-like API
	LogLevel        string        // "debug", "info", "warn", "error" (default "info")
	RateLimit       int           // General rate limit in requests/min (0 = disabled)
	ShutdownTimeout time.Duration // Graceful shutdown timeout (default 30s)
	DBPath          string        // Path to database file (default: <sharedDir>/.beamdrop/beamdrop.db)
}

Jump to

Keyboard shortcuts

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