s

package
v0.0.46 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: GPL-3.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	FrontEndRoot        = "/"
	FrontEndAdminFolder = "admin"
	FrontEndAdminPath   = FrontEndRoot + FrontEndAdminFolder
)
View Source
const (
	// Files in 'fe' folder.
	FrontEndStaticFileName_AdminHtmlPage = "admin.html"
	FrontEndStaticFileName_AdminJs       = "admin.js"
	FrontEndStaticFileName_ArgonJs       = "argon2.js"
	FrontEndStaticFileName_ArgonWasm     = "argon2.wasm"
	FrontEndStaticFileName_BppJs         = "bpp.js"
	FrontEndStaticFileName_IndexHtmlPage = "index.html"
	FrontEndStaticFileName_LoaderScript  = "loader.js"
	FrontEndStaticFileName_CssStyles     = "styles.css"

	// Files in root folder.
	FrontEndStaticFileName_FavIcon = "favicon.png"
)

Front end static files.

View Source
const (
	ClientIPAddressSource_Direct       = 1
	ClientIPAddressSource_CustomHeader = 2
)
View Source
const (
	ErrUnknownClientIPAddressSource = "unknown client IP address source"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DbSettings

type DbSettings = cs.DbSettings

DbSettings are parameters of the Database.

type ExtHttpsSettings

type ExtHttpsSettings = cs.HttpsSettings

ExtHttpsSettings are settings of an HTTPS server for external requests.

type IntHttpSettings

type IntHttpSettings = cs.HttpSettings

IntHttpSettings are settings of an HTTP server for internal requests.

type Settings

type Settings struct {
	// Path to the file with these settings.
	FilePath string `json:"-"`

	// Program versioning information.
	VersionInfo *ver.Versioneer `json:"-"`

	IntHttpSettings  `json:"intHttp"`
	ExtHttpsSettings `json:"extHttps"`
	DbSettings       `json:"db"`
	SystemSettings   `json:"system"`

	// External services.
	AcmSettings cs.ServiceClientSettings `json:"acm"`
	MmSettings  cs.ServiceClientSettings `json:"mm"`
	NmSettings  cs.ServiceClientSettings `json:"nm"`
	SmSettings  cs.ServiceClientSettings `json:"sm"`
}

Settings is Server's settings.

func NewSettingsFromFile

func NewSettingsFromFile(filePath string, versionInfo *ver.Versioneer) (stn *Settings, err error)

func (*Settings) Check

func (stn *Settings) Check() (err error)

func (*Settings) UseConstructor

func (stn *Settings) UseConstructor(filePath string, versionInfo *ver.Versioneer) (cm.ISettings, error)

type SystemSettings

type SystemSettings struct {
	SettingsVersion uint   `json:"settingsVersion"`
	SiteName        string `json:"siteName"`
	SiteDomain      string `json:"siteDomain"`

	// Firewall.
	IsFirewallUsed bool `json:"isFirewallUsed"`

	// ClientIPAddressSource setting selects where to search for client's IP
	// address. '1' means that IP address is taken directly from the client's
	// address of the HTTP request; '2' means that IP address is taken from the
	// custom HTTP header which is configured by the ClientIPAddressHeader
	// setting. One of the most common examples of a custom header may be the
	// 'X-Forwarded-For' HTTP header. For most users the first variant ('1') is
	// the most suitable. The second variant ('2') may be used if you are
	// proxying requests of your clients somewhere inside your own network
	// infrastructure, such as via a load balancer or with a reverse proxy.
	ClientIPAddressSource byte   `json:"clientIPAddressSource"`
	ClientIPAddressHeader string `json:"clientIPAddressHeader"`

	// Captcha.
	CaptchaImgServerHost string `json:"captchaImgServerHost"`
	CaptchaImgServerPort uint16 `json:"captchaImgServerPort"`
	CaptchaFolder        string `json:"captchaFolder"`

	// Sessions and messages.
	SessionMaxDuration uint `json:"sessionMaxDuration"`
	MessageEditTime    uint `json:"messageEditTime"`
	PageSize           uint `json:"pageSize"`

	// URL paths.
	ApiFolder              string `json:"apiFolder"`
	PublicSettingsFileName string `json:"publicSettingsFileName"`

	// Front end.
	IsFrontEndEnabled         bool   `json:"isFrontEndEnabled"`
	FrontEndStaticFilesFolder string `json:"frontEndStaticFilesFolder"`
	FrontEndAssetsFolder      string `json:"frontEndAssetsFolder"`

	// Development settings.
	IsDebugMode                               bool   `json:"isDebugMode"`
	IsDeveloperMode                           bool   `json:"isDeveloperMode"`
	DevModeHttpHeaderAccessControlAllowOrigin string `json:"devModeHttpHeaderAccessControlAllowOrigin"`
}

SystemSettings are system settings. Many of these settings must be synchronised with other modules.

func (SystemSettings) Check

func (s SystemSettings) Check() (err error)

Jump to

Keyboard shortcuts

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