config

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: MIT Imports: 9 Imported by: 3

README

Sample config files

FTP Server behind a NAT gateway

{
    "$schema": "https://raw.githubusercontent.com/fclairamb/ftpserver/main/config-schema.json",
    "listen_address": ":2121",
    "public_host": "1.2.3.4",
    "accesses": [
        {
            "user": "test",
            "pass": "test",
            "fs": "os",
            "params": {
                "basePath": "/tmp"
            }
        }
    ]
}

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

This section is empty.

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 log.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 log.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

func (*Config) HashPlaintextPasswords added in v0.13.0

func (c *Config) HashPlaintextPasswords() error

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