config

package
v6.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 7 Imported by: 0

Documentation

Overview

Package config provides tools to load and validate configuration data for Traffic Ops API tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	TrafficOps   TrafficOps   `json:"trafficOps"`
	TrafficOpsDB TrafficOpsDB `json:"trafficOpsDB"`
	Default      Default      `json:"default"`
	UseIMS       bool         `json:"use_ims"`
	// Sets whether or not to perform tests that involve ISO generation
	NoISO bool `json:"noISO"`
}

Config reflects the structure of the test-to-api.conf file

func LoadConfig

func LoadConfig(confPath string) (Config, error)

LoadConfig - reads the config file into the Config struct

func (Config) DebugLog

func (c Config) DebugLog() log.LogLocation

DebugLog - troubleshooting messages

func (Config) ErrorLog

func (c Config) ErrorLog() log.LogLocation

ErrorLog - critical messages

func (Config) EventLog

func (c Config) EventLog() log.LogLocation

EventLog - access.log high level transactions

func (Config) InfoLog

func (c Config) InfoLog() log.LogLocation

InfoLog - information messages

func (Config) WarningLog

func (c Config) WarningLog() log.LogLocation

WarningLog - warning messages

type Default

type Default struct {
	Session            Session   `json:"session"`
	Log                Locations `json:"logLocations"`
	IncludeSystemTests bool      `json:"includeSystemTests"`
}

Default - config section

type Locations

type Locations struct {
	Debug   string `json:"debug"`
	Event   string `json:"event"`
	Error   string `json:"error"`
	Info    string `json:"info"`
	Warning string `json:"warning"`
}

Locations - reflects the structure of the database.conf file

type Session

type Session struct {
	TimeoutInSecs int `json:"timeoutInSecs" envconfig:"SESSION_TIMEOUT_IN_SECS"`
}

Session - config section

type TrafficOps

type TrafficOps struct {
	// URL - The point to the Traffic Ops instance being tested
	URL string `json:"URL" envconfig:"TO_URL"`

	// UserPassword - The Traffic Ops test user password hitting the API
	UserPassword string `json:"password" envconfig:"TO_USER_PASSWORD"`

	// User - The Traffic Ops Users
	Users Users `json:"users"`

	// Insecure - ignores insecure ssls certs that were self-generated
	Insecure bool `json:"sslInsecure" envconfig:"SSL_INSECURE"`
}

TrafficOps - config section

type TrafficOpsDB

type TrafficOpsDB struct {
	// Name - Traffic Ops Database name where the test data will be setup
	Name string `json:"dbname" envconfig:"TODB_NAME"`

	// Hostname - Traffic Ops Database hostname where Postgres is running
	Hostname string `json:"hostname" envconfig:"TODB_HOSTNAME"`

	// User - database user that Traffic Ops is using to point to the 'to_test' database
	User string `json:"user" envconfig:"TODB_USER"`

	// Password - database password for the User above
	Password string `json:"password" envconfig:"TODB_PASSWORD"`

	// Port - Postgres port running that has the to_test schema
	Port string `json:"port" envconfig:"TODB_PORT"`

	// DBType - will be 'Pg' by default but tells the Golang database driver
	//          the database type
	DBType string `json:"type" envconfig:"TODB_TYPE"`

	// SSL - Flag that tells the database driver that the Postgres instances has TLS enabled
	SSL bool `json:"ssl" envconfig:"TODB_SSL"`

	// Description - database description
	Description string `json:"description" envconfig:"TODB_DESCRIPTION"`
}

TrafficOpsDB - config section

type Users

type Users struct {

	// DisallowedUser - The Traffic Ops Disallowed user
	Disallowed string `json:"disallowed" envconfig:"TO_USER_DISALLOWED"`

	// ReadOnly - The Traffic Ops Read Only user
	ReadOnly string `json:"readOnly" envconfig:"TO_USER_READ_ONLY"`

	// Operations - The Traffic Ops Operations user
	Operations string `json:"operations" envconfig:"TO_USER_OPERATIONS"`

	// AdminUser - The Traffic Ops Admin user
	Admin string `json:"admin" envconfig:"TO_USER_ADMIN"`

	// PortalUser - The Traffic Ops Portal user
	Portal string `json:"portal" envconfig:"TO_USER_PORTAL"`

	// FederationUser - The Traffic Ops Federation user
	Federation string `json:"federation" envconfig:"TO_USER_FEDERATION"`

	// Extension - The Traffic Ops Extension user
	Extension string `json:"extension" envconfig:"TO_USER_EXTENSION"`
}

Users "users" section of the test-to-api.conf file

Jump to

Keyboard shortcuts

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