config

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: MIT Imports: 2 Imported by: 0

README

config

Package config contains functionality for extracting configuration options from a JSON-encoded configuration file.

The configuration file should conform to the following format:

{
    "hvca_url": "https://emea.api.hvca.globalsign.com:8443",
    "hvca_version": "v2",
    "api_key": "9999999999999999",
    "api_secret": "ffffffffffffffffffffffffffffffffffffffff",
    "cert_file": "/fully/qualified/path/to/tls/certificate.pem",
    "key_file": "/fully/qualified/path/to/tls/key.pem",
    "key_passphrase": "my_secret_passphrase",
    "timeout": 5
}

Documentation

Overview

Package config contains functionality for extracting configuration options from a JSON-encoded configuration file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// URL is the URL (including port) to the HVCA server.
	URL string `json:"url"`

	// APIKey is the client-specific API key used to login.
	APIKey string `json:"api_key"`

	// APISecret is the client-specific API secret used to login.
	APISecret string `json:"api_secret"`

	// CertFile is the path of the client certificate file.
	CertFile string `json:"cert_file"`

	// KeyFile is the path of the client key file.
	KeyFile string `json:"key_file"`

	// KeyPassphrase is the passphrase for the client key. If the key is not
	// encrypted, this should be set to the emptry string.
	KeyPassphrase string `json:"key_passphrase"`

	// If InsecureSkipVerify is true, TLS accepts any certificate
	// presented by the server and any host name in that certificate.
	// In this mode, TLS is susceptible to man-in-the-middle attacks.
	// This should be used only for testing.
	InsecureSkipVerify bool `json:"insecure_skip_verify"`

	// ExtraHeaders contains custom HTTP request headers to be passed to the
	// HVCA server with each request.
	ExtraHeaders map[string]string `json:"extra_headers,omitempty"`

	// Timeout is the maximum time in seconds for an HVCA API request.
	Timeout int `json:"timeout"`
}

Config contains settings from an HVClient configuration file.

func NewFromFile

func NewFromFile(filename string) (*Config, error)

NewFromFile creates a new Config object from a configuration file.

Jump to

Keyboard shortcuts

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