config

package
v0.5.0-beta Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MemoryMeta    = "memory"
	SqliteMeta    = "sqlite"
	PostgresMeta  = "postgres"
	S3Storage     = "s3"
	OSSStorage    = "oss"
	MinioStorage  = "minio"
	WebdavStorage = "webdav"
	LocalStorage  = "local"
	MemoryStorage = "memory"

	AESEncryption      = "AES"
	ChaCha20Encryption = "ChaCha20"
)
View Source
const (
	DefaultConfigBase = "nanafs.conf"
)

Variables

View Source
var FilePath string

Functions

func LocalUserPath

func LocalUserPath() string

func Verify

func Verify(cfg *Config) error

Types

type Api

type Api struct {
	Enable  bool   `json:"enable"`
	Host    string `json:"host"`
	Port    int    `json:"port"`
	Pprof   bool   `json:"pprof"`
	Metrics bool   `json:"metrics"`
}

type Config

type Config struct {
	Api    Api     `json:"api"`
	FUSE   FUSE    `json:"fuse"`
	Webdav *Webdav `json:"webdav,omitempty"`

	Meta             Meta       `json:"meta"`
	Storages         []Storage  `json:"storages"`
	GlobalEncryption Encryption `json:"global_encryption"`

	Workflow Workflow           `json:"workflow"`
	Plugin   *Plugin            `json:"plugin,omitempty"`
	FS       *FS                `json:"fs,omitempty"`
	Indexer  *Indexer           `json:"indexer,omitempty"`
	Friday   *fridayconf.Config `json:"friday,omitempty"`

	CacheDir  string `json:"cache_dir,omitempty"`
	CacheSize int    `json:"cache_size,omitempty"`
	Debug     bool   `json:"debug,omitempty"`
}

type Encryption

type Encryption struct {
	Enable    bool   `json:"enable"`
	Method    string `json:"method"`
	SecretKey string `json:"secret_key"`
}

type FS

type FS struct {
	Owner     FSOwner `json:"owner,omitempty"`
	Writeback bool    `json:"writeback,omitempty"`
	PageSize  int     `json:"page_size,omitempty"`
}

type FSOwner

type FSOwner struct {
	Uid int64 `json:"uid"`
	Gid int64 `json:"gid"`
}

type FUSE

type FUSE struct {
	Enable       bool     `json:"enable"`
	RootPath     string   `json:"root_path"`
	MountOptions []string `json:"mount_options,omitempty"`
	DisplayName  string   `json:"display_name,omitempty"`
	VerboseLog   bool     `json:"verbose_log,omitempty"`

	EntryTimeout *int `json:"entry_timeout,omitempty"`
	AttrTimeout  *int `json:"attr_timeout,omitempty"`
}

type Indexer

type Indexer struct {
	LocalIndexerDir string `json:"local_indexer_dir"`
}

type Loader

type Loader interface {
	GetConfig() (Config, error)
}

func NewConfigLoader

func NewConfigLoader() Loader

type Meta

type Meta struct {
	Type string `json:"type"`
	Path string `json:"path,omitempty"`
	DSN  string `json:"dsn,omitempty"`
}

type MinIOConfig

type MinIOConfig struct {
	Endpoint        string `json:"endpoint"`
	AccessKeyID     string `json:"access_key_id"`
	SecretAccessKey string `json:"secret_access_key"`
	BucketName      string `json:"bucket_name"`
	Location        string `json:"location"`
	Token           string `json:"token"`
	UseSSL          bool   `json:"use_ssl"`
}

type OSSConfig

type OSSConfig struct {
	Endpoint        string `json:"endpoint"`
	AccessKeyID     string `json:"access_key_id"`
	AccessKeySecret string `json:"access_key_secret"`
	BucketName      string `json:"bucket_name"`
}

type OverwriteUser

type OverwriteUser struct {
	UID      int64  `json:"uid"`
	GID      int64  `json:"gid"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type Plugin

type Plugin struct {
	BasePath string `json:"base_path"`
}

type S3Config

type S3Config struct {
	AccessKeyID     string `json:"access_key_id"`
	SecretAccessKey string `json:"secret_access_key"`
	Region          string `json:"region"`
	BucketName      string `json:"bucket_name"`
	UsePathStyle    bool   `json:"use_path_style"`
}

type Storage

type Storage struct {
	ID         string               `json:"id"`
	Type       string               `json:"type"`
	LocalDir   string               `json:"local_dir,omitempty"`
	S3         *S3Config            `json:"s3,omitempty"`
	MinIO      *MinIOConfig         `json:"minio,omitempty"`
	OSS        *OSSConfig           `json:"oss,omitempty"`
	Webdav     *WebdavStorageConfig `json:"webdav,omitempty"`
	Encryption *Encryption          `json:"encryption,omitempty"`
}

type Version

type Version struct {
	Major   int    `json:"major"`
	Minor   int    `json:"minor"`
	Patch   int    `json:"patch"`
	Release string `json:"release"`
	Git     string `json:"git"`
}

func VersionInfo

func VersionInfo() Version

func (Version) Version

func (v Version) Version() string

type Webdav

type Webdav struct {
	Enable         bool            `json:"enable"`
	Host           string          `json:"host"`
	Port           int             `json:"port"`
	OverwriteUsers []OverwriteUser `json:"overwrite_users"`
}

type WebdavStorageConfig

type WebdavStorageConfig struct {
	ServerURL string `json:"server_url"`
	Username  string `json:"username"`
	Password  string `json:"password"`
	Insecure  bool   `json:"insecure,omitempty"`
}

type Workflow

type Workflow struct {
	Enable     bool   `json:"enable"`
	JobWorkdir string `json:"job_workdir"`
}

Jump to

Keyboard shortcuts

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