config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package config holds the global configuration of this application.

Index

Constants

View Source
const (
	CableTypesPath   = "cable_types"
	CablesPath       = "cables"
	DepartmentsPath  = "departments"
	DevicesPath      = "devices"
	LocationsPath    = "locations"
	MonitoringPath   = "monitoring"
	OpenAPIPath      = "openapi"
	PlacesPath       = "places"
	PlugsPath        = "plugs"
	PrefixesPath     = "prefixes"
	PrometheusPath   = "metrics"
	RolesPath        = "roles"
	SAMLPath         = "saml"
	UsersPath        = "users"
	ZTUsersRolesPath = "zt_users_roles"
)

API paths. These are also used as db table names.

Variables

View Source
var (
	Build              string
	DBHost             = flag.String("db-host", "127.0.0.1", "Host of the database")
	DBInitScript       = flag.String("db-init-script", "/home/chris/src/kabelliste/backend/scripts/init.sql", "init script for database testing")
	DBLimit            = flag.Uint64("db-limit", 10, "default amount of elements per page")
	DBName             = flag.String("db-name", "cable_list", "name of the relevant db table")
	DBPage             = flag.Uint64("db-page", 1, "default starting page")
	DBPassword         = flag.String("db-password", "secret", "password of the database user")
	DBPort             = flag.String("db-port", "3306", "Port of the database")
	DBUser             = flag.String("db-user", "root", "user of the database")
	DNS                = flag.String("dns", "localhost", "domain where this server is running")
	ExcelTemplateFile  = flag.String("excel-template-file", "excel-template.xlsx", "filename of the excel template file (see resource-dir)")
	JWTExpiresin       = flag.String("jwt-expiresin", "30m", "amount of time after a JWT expires")
	JWTSecret          = flag.String("jwt-secret", "secret", "private JWT secret for signing")
	LDAPHost           = flag.String("ldap-host", "", "LDAP host for quering user data")
	LDAPPassword       = flag.String("ldap-password", "", "LDAP password for the service account")
	LDAPUser           = flag.String("ldap-user", "", "LDAP user for the service account")
	MaxBytes           = flag.Int64("max-bytes", 1048576, "amount of bytes a client can send at a maximum")
	PathPrefix         = flag.String("path-prefix", "/api", "prefix of all API paths")
	Port               = flag.String("port", "8000", "port where this server should be listening")
	Protocol           = flag.String("protocol", "http://", "used protocol")
	HTTPQuerySeperator = flag.String("http-query-seperator", ",", "seperator for HTTP query lists of values")
	ResourceDir        = flag.String("resource-dir", "static/", "directory where files intended to be shared are located")
	SAMLActive         = flag.Bool("saml-active", false, "Activate SAML authentifcation, otherwise no authentication step is performed")
	SAMLAttributeEmail = flag.String("saml-attribute-email", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress", "SAML attribute email")
	SAMLCert           = flag.String("saml-cert", "kabelliste.crt", "SAML cert")
	SAMLEntityID       = flag.String("saml-entityid", "urn:node:kabelliste", "SAML EntityID")
	SAMLEntrypoint     = flag.String("saml-entrypoint", "https://stubidp.sustainsys.com/Metadata", "SAML entrypoint")
	SAMLKey            = flag.String("saml-key", "kabelliste.key", "SAML key")
	Version            string
)

Flag and build configurations.

View Source
var PluralToSingular = map[string]string{
	"abbreviations": "abbreviation",
	"cable_types":   "cable_type",
	"cables":        "cable",
	"creators":      "creator",
	"departments":   "department",
	"devices":       "device",
	"emails":        "email",
	"froms":         "from",
	"labels":        "label",
	"locations":     "location",
	"numbers":       "number",
	"places":        "place",
	"plugs":         "plug",
	"ports":         "port",
	"prefixes":      "prefix",
	"reservers":     "reserver",
	"roles":         "role",
	"tos":           "to",
	"users":         "user",
}

HTTP Queries keywords and database tables should conform to the plural key. The singular should conform to single entities of the keys (i.e. singular_id replacments)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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