cfg

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package cfg contains global variables that represent the current wiki configuration, including CLI options, configuration file values and header links.

Index

Constants

This section is empty.

Variables

View Source
var (
	WikiName      string
	NaviTitleIcon string

	HomeHypha           string
	UserHypha           string
	HeaderLinksHypha    string
	RedirectionCategory string

	ListenAddr string
	URL        string

	UseAuth           bool
	AllowRegistration bool
	RegistrationLimit uint64
	Locked            bool
	UseWhiteList      bool
	WhiteList         []string

	CommonScripts []string
	ViewScripts   []string
	EditScripts   []string

	// TelegramEnabled if both TelegramBotToken and TelegramBotName are not empty strings.
	TelegramEnabled  bool
	TelegramBotToken string
	TelegramBotName  string
)

These variables represent the configuration. You are not meant to modify them after they were set. See https://mycorrhiza.wiki/hypha/configuration/fields for the documentation.

View Source
var WikiDir string

WikiDir is a full path to the wiki storage directory, which also must be a git repo. This variable is set in parseCliArgs().

Functions

func ReadConfigFile

func ReadConfigFile(path string) error

ReadConfigFile reads a config on the given path and stores the configuration. Call it sometime during the initialization.

Types

type Authorization

type Authorization struct {
	UseAuth           bool
	AllowRegistration bool
	RegistrationLimit uint64   `comment:"This field controls the maximum amount of allowed registrations."`
	Locked            bool     `comment:"Set if users have to authorize to see anything on the wiki."`
	UseWhiteList      bool     `comment:"If true, WhiteList is used. Else it is not used."`
	WhiteList         []string `delim:"," comment:"Usernames of people who can log in to your wiki separated by comma."`
}

Authorization is a section of Config that has fields related to authorization and authentication.

type Config

type Config struct {
	WikiName      string `comment:"This name appears in the header and on various pages."`
	NaviTitleIcon string `comment:"This icon is used in the breadcrumbs bar."`
	Hyphae
	Network
	Authorization
	CustomScripts `comment:"You can specify additional scripts to load on different kinds of pages, delimited by a comma ',' sign."`
	Telegram      `` /* 132-byte string literal not displayed */
}

Config represents a Mycorrhiza wiki configuration file. This type is used only when reading configs.

type CustomScripts

type CustomScripts struct {
	// CommonScripts: everywhere...
	CommonScripts []string `delim:"," comment:"These scripts are loaded from anywhere."`
	// ViewScripts: /hypha, /rev
	ViewScripts []string `delim:"," comment:"These scripts are only loaded on view pages."`
	// Edit: /edit
	EditScripts []string `delim:"," comment:"These scripts are only loaded on the edit page."`
}

CustomScripts is a section with paths to JavaScript files that are loaded on specified pages.

type Hyphae

type Hyphae struct {
	HomeHypha           string `comment:"This hypha will be the main (index) page of your wiki, served on /."`
	UserHypha           string `comment:"This hypha is used as a prefix for user hyphae."`
	HeaderLinksHypha    string `comment:"You can also specify a hypha to populate your own custom header links from."`
	RedirectionCategory string `comment:"Redirection hyphae will be added to this category. Default: redirection."`
}

Hyphae is a section of Config which has fields related to special hyphae.

type Network

type Network struct {
	ListenAddr string
	URL        string `comment:"Set your wiki's public URL here. It's used for OpenGraph generation and syndication feeds."`
}

Network is a section of Config that has fields related to network stuff.

type Telegram added in v1.3.0

type Telegram struct {
	TelegramBotToken string `comment:"Token of your bot."`
	TelegramBotName  string `comment:"Username of your bot, sans @."`
}

Telegram is the section of Config that sets Telegram authorization.

Jump to

Keyboard shortcuts

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