config

package
v0.16.7 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 14 Imported by: 4

README

Sample config files

The config file format is described in the main README and by the JSON schema.

When the server starts without -conf and no ftpserver.json exists, it creates one with a test user serving /tmp. That user gets a random password, printed once in the logs (docker logs <container> for the docker images) and stored bcrypt-hashed in the file. Set your own users and passwords in the file afterwards.

  • behind_nat.json: FTP server behind a NAT gateway, advertising its public IP address for passive transfers.
  • hashed_passwords.json: plain-text, bcrypt and sha512crypt passwords (the password of each user is its user name).
  • log_file.json: logging to a file.

Each backend also has its own sample in its documentation.

Documentation

Overview

Package config provides all the config management

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownUser = errors.New("unknown user")

ErrUnknownUser is returned when the provided user cannot be identified through our authentication mechanism

Functions

func HashPassword added in v0.16.5

func HashPassword(pass string) (string, error)

HashPassword returns the bcrypt hash of a plain-text password, in the format expected in the config file

Types

type Config

type Config struct {
	Content *confpar.Content
	// contains filtered or unexported fields
}

Config provides the general server config

func FromContent added in v0.12.0

func FromContent(content *confpar.Content, fileName string, logger *slog.Logger) (*Config, error)

FromContent creates a new config instance from a pre-created Content and logger. The fileName should indicate origin of the given Content, but the file will never be opened.

func NewConfig

func NewConfig(fileName string, logger *slog.Logger) (*Config, error)

NewConfig creates a new config instance

func (*Config) CheckAccesses

func (c *Config) CheckAccesses() error

CheckAccesses checks all accesses

func (*Config) GetAccess

func (c *Config) GetAccess(user string, pass string) (*confpar.Access, error)

GetAccess return a file system access given some credentials. Accesses are evaluated in their declaration order.

func (*Config) HashPlaintextPasswords added in v0.13.0

func (c *Config) HashPlaintextPasswords() error

HashPlaintextPasswords replaces all the plain-text passwords of the config file by their bcrypt equivalent, and saves the config file.

func (*Config) Load

func (c *Config) Load() error

Load the config

func (*Config) Prepare

func (c *Config) Prepare() error

Prepare the config before using it

Directories

Path Synopsis
Package confpar provide the core parameters of the config
Package confpar provide the core parameters of the config

Jump to

Keyboard shortcuts

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