config

package
v0.0.0-...-e7db92f Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package config defines the primary configuration structure loaded from JSON configuration either in the current working directory or in `/etc/tiyo/tiyo.json`

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

Index

Constants

View Source
const (
	TIMEOUT             time.Duration = 5 * time.Second
	SESSION_COOKIE_NAME string        = "__tiyo_session"
	SSO_SESSION_NAME    string        = "__tiyo_sso_session"
)

TIMEOUT : Default timeout for http requests

Variables

View Source
var Designate string = ""

Functions

This section is empty.

Types

type Config

type Config struct {

	// Defines the primary location on the fileserver
	// for files to be stored
	SequenceBaseDir string `json:"sequenceBaseDir"`

	// If true, will configure an nginx server running in
	// the same location as flow server for access to services
	// running inside the cluster.
	ExternalNginx bool `json:"externalNginx"`

	// The name of the database file
	Dbname string `json:"dbname"`

	// If true will skip certificate checking
	UseInsecureTLS bool `json:"skipVerify"`

	// Host configuration for the assemble server
	Assemble Host `json:"assemble"`

	// Host configuration for the flow server
	Flow Host `json:"flow"`

	// Kubernetes configuration
	Kubernetes Kubernetes `json:"kubernetes"`

	// Docker configuration
	Docker Docker `json:"docker"`

	// AppName for testing syphon locally
	AppName string `json:"appname"`

	// Primary DNS name for services
	DNSName string `json:"dnsName"`

	// Config for SAML 2fa
	SAML *SAML `json:"saml"`

	// Base directory for configuration files - default /etc/tiyo
	ConfigBase string

	// Base directory for the database and container creation - default /var/tiyo
	DbDir string

	// Timeout - constant TIMEOUT
	TIMEOUT time.Duration
}

Config : Primary configuration object

func NewConfig

func NewConfig() (*Config, error)

NewConfig : Create a new configuration object and load the config file

func (*Config) AssembleServer

func (config *Config) AssembleServer() string

AssembleServer : Get the address of the assemble server

func (*Config) ConfigureSAML

func (config *Config) ConfigureSAML() error

func (*Config) FlowServer

func (config *Config) FlowServer() string

FlowServer : Get the address of the flow FlowServer

func (*Config) GenerateTOTP

func (c *Config) GenerateTOTP(email string) (*otp.Key, error)

func (*Config) GetPassphrase

func (config *Config) GetPassphrase(from string) string

GetPassphrase : Get the server specific passphrase for encryption

from string Whether to retrieve `assemble` or `flow` passphrases

future, this will optionally read the encryption passphrase from vault

func (*Config) ResetTotp

func (c *Config) ResetTotp(email string) (*otp.Key, error)

type Docker

type Docker struct {

	// Docker registry to use. Default for this is dockerhub
	Registry string `json:"registry"`

	// The username to log in to the docker registry with
	Username string `json:"username"`

	// Api token to authenticate against the registry
	Token string `json:"token"`

	// Principle location for upstream containers.
	//
	// When defined, this will be used as a source for listing
	// containers in the `applications` sidebar, and a primary
	// source for all vanilla containers.
	Upstream string `json:"upstream"`

	// The location to store all containers built by the tiyo
	// flow server. Most containers in this location would normally
	// include `tiyo syphon` as their `ps 1`
	Primary string `json:"primary"`

	// Set to true if both primary and upstream are the same location
	SameSource bool `default:"false"`
}

Docker : Configiration for the Docker client

type Host

type Host struct {

	// The hostname to run the server on
	Host string `json:"host"`

	// The port to listen on. For assemble, the default is 8180
	// and for flow the default is 8280.
	Port int `json:"port"`

	// An optional certificate to encrypt traffic into the host
	Cacert string `json:"cacert,omitempty"`

	// An optional certificate key - mutually inclusive with Cacert
	Cakey string `json:"cakey,omitempty"`

	// A passphrase to encrypt user provided credentials
	//
	// For assemble, this should be a secure passphrase, normally
	// generated as the output of `pwgen -synr \`\"\\ 20 1`
	//
	// For flow, this should be the encrypted version of the same
	// password which can be generated by running `tiyo encrypt primary`
	// after completing the assemble config
	Passphrase string `json:"passphrase,omitempty"`

	// ClientSecure - syphon required switch for http(s)
	ClientSecure bool `json:"secure,omitempty"`
}

Host : Define how a host should be configured

A host is one of `assemble` or `flow` and will contain information on how to start the host. If Cacert and CaKey are defined and not empty, the host will start on an SSL encrypted channel. This is the recommended behaviour in all instances, particularly for the assemble server which encrypts user provided passwords over the wire.

type Kubernetes

type Kubernetes struct {

	// A path to the kubernetes cluster config to use
	ConfigFile string `json:"kubeconfig"`

	// The principle namespace to deploy into
	Namespace string `json:"namespace"`

	// The data-volume to mount
	Volume string `json:"volume"`
}

Kubernetes : Define the connection to the kubernetes cluster

type SAML

type SAML struct {
	IDPMetadata string             `json:"idp_metadata"`
	PrivateKey  []byte             `json:"private_key"`
	Certificate []byte             `json:"certificate"`
	SamlSP      *samlsp.Middleware `json:"-"`
}

Jump to

Keyboard shortcuts

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