conf

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BuildVersion string
	BuildTime    string
	BuildCommit  string
)

Build time and commit information.

⚠️ WARNING: should only be set by "-ldflags".

View Source
var (
	// Application settings
	App struct {
		// ⚠️ WARNING: Should only be set by the main package (i.e. "main.go").
		Version string `ini:"-"`

		Env      string
		HTTPHost string `ini:"HTTP_ADDR"`
		HTTPPort int    `ini:"HTTP_PORT"`
	}

	// Site settings
	Site struct {
		Description string
		ExternalURL string `ini:"EXTERNAL_URL"`
	}

	// Asset settings
	Asset struct {
		CustomDirectory string
	}

	// Page settings
	Page struct {
		HasLandingPage  bool
		DocsBasePath    string
		CustomDirectory string
	}

	// I18n settings
	I18n struct {
		Languages       []string
		Names           []string
		CustomDirectory string
	}

	// Documentation settings
	Docs struct {
		Type               DocType
		Target             string
		TargetDir          string
		EditPageLinkFormat string
	}

	// Extension settings
	Extension struct {
		Plausible struct {
			Enabled bool
			Domain  string
		}
		GoogleAnalytics struct {
			Enabled       bool
			MeasurementID string `ini:"MEASUREMENT_ID"`
		}
		Disqus struct {
			Enabled   bool
			Shortname string
		}
		Utterances struct {
			Enabled   bool
			Repo      string
			IssueTerm string
			Label     string
			Theme     string
		}
	}
)
View Source
var File *ini.File

File is the configuration object.

Functions

func Init

func Init(customConf string) (err error)

Init initializes configuration from conf assets and given custom configuration file. If `customConf` is empty, it falls back to default location, i.e. "<WORK DIR>/custom".

It is safe to call this function multiple times with desired `customConf`, but it is not concurrent safe.

NOTE: The order of loading configuration sections matters as one may depend on another.

Types

type DocType

type DocType string
const (
	DocTypeLocal  DocType = "local"
	DocTypeRemote DocType = "remote"
)

Jump to

Keyboard shortcuts

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