config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2018 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileName = "config.ini"
)

Variables

This section is empty.

Functions

func Save

func Save(uc *Config) error

Types

type AppCfg

type AppCfg struct {
	SiteName string `ini:"site_name"`
	Host     string `ini:"host"`

	// Site appearance
	Theme      string `ini:"theme"`
	JSDisabled bool   `ini:"disable_js"`
	WebFonts   bool   `ini:"webfonts"`

	// Users
	SingleUser       bool `ini:"single_user"`
	OpenRegistration bool `ini:"open_registration"`
	MinUsernameLen   int  `ini:"min_username_len"`
	MaxBlogs         int  `ini:"max_blogs"`

	// Federation
	Federation  bool `ini:"federation"`
	PublicStats bool `ini:"public_stats"`
	Private     bool `ini:"private"`
}

func (AppCfg) CanCreateBlogs

func (ac AppCfg) CanCreateBlogs(currentlyUsed uint64) bool

func (AppCfg) FriendlyHost

func (ac AppCfg) FriendlyHost() string

FriendlyHost returns the app's Host sans any schema

type Config

type Config struct {
	Server   ServerCfg   `ini:"server"`
	Database DatabaseCfg `ini:"database"`
	App      AppCfg      `ini:"app"`
}

func Load

func Load() (*Config, error)

func New

func New() *Config

type DatabaseCfg

type DatabaseCfg struct {
	Type     string `ini:"type"`
	User     string `ini:"username"`
	Password string `ini:"password"`
	Database string `ini:"database"`
	Host     string `ini:"host"`
	Port     int    `ini:"port"`
}

type ServerCfg

type ServerCfg struct {
	HiddenHost string `ini:"hidden_host"`
	Port       int    `ini:"port"`

	Dev bool `ini:"-"`
}

type SetupData

type SetupData struct {
	User   *UserCreation
	Config *Config
}

func Configure

func Configure() (*SetupData, error)

type UserCreation

type UserCreation struct {
	Username   string
	HashedPass []byte
}

Jump to

Keyboard shortcuts

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