config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	SuperusersCollection = "_superusers"
	EnvConfigPath        = "PBCTL_CONFIG"
	EnvProfile           = "PBCTL_PROFILE"
	EnvReadOnly          = "PBCTL_READ_ONLY"
	EnvURL               = "PBCTL_URL"
	EnvToken             = "PBCTL_TOKEN"
	EnvIdentity          = "PBCTL_IDENTITY"
	EnvPassword          = "PBCTL_PASSWORD"
	EnvProfileName       = "(environment)"
)

Variables

View Source
var PolicyPath = "/etc/pbctl/policy.json"

Functions

func IsReservedHeader added in v0.1.1

func IsReservedHeader(name string) bool

func Path

func Path() (string, error)

func ReadOnlySource

func ReadOnlySource(policy *Policy, profile *Profile, host string, flag bool) string

Types

type File

type File struct {
	Current  string              `json:"current,omitempty"`
	Profiles map[string]*Profile `json:"profiles"`
}

func Load

func Load() (*File, error)

func (*File) Names

func (f *File) Names() []string

func (*File) Resolve

func (f *File) Resolve(requested string) (string, *Profile, error)

func (*File) Save

func (f *File) Save() error

type Policy

type Policy struct {
	ReadOnly      bool     `json:"read_only"`
	ReadOnlyHosts []string `json:"read_only_hosts"`
}

func LoadPolicy

func LoadPolicy() (*Policy, error)

func (*Policy) ForcesReadOnly

func (p *Policy) ForcesReadOnly(host string) bool

type Profile

type Profile struct {
	URL            string            `json:"url"`
	AuthCollection string            `json:"auth_collection,omitempty"`
	Identity       string            `json:"identity,omitempty"`
	IdentityEnv    string            `json:"identity_env,omitempty"`
	Password       string            `json:"password,omitempty"`
	PasswordEnv    string            `json:"password_env,omitempty"`
	Token          string            `json:"token,omitempty"`
	TokenEnv       string            `json:"token_env,omitempty"`
	Gateway        bool              `json:"gateway,omitempty"`
	GatewayKey     string            `json:"gateway_key,omitempty"`
	HeaderEnv      map[string]string `json:"header_env,omitempty"`
	ReadOnly       bool              `json:"read_only"`
	ConfirmWrites  bool              `json:"confirm_writes,omitempty"`
}

func (*Profile) BaseURL

func (p *Profile) BaseURL() (*url.URL, error)

func (*Profile) Collection

func (p *Profile) Collection() string

func (*Profile) HasCredentials

func (p *Profile) HasCredentials() bool

func (*Profile) ResolvedHeaders added in v0.1.1

func (p *Profile) ResolvedHeaders() map[string]string

func (*Profile) ResolvedIdentity added in v0.1.1

func (p *Profile) ResolvedIdentity() string

func (*Profile) ResolvedPassword

func (p *Profile) ResolvedPassword() string

func (*Profile) ResolvedToken

func (p *Profile) ResolvedToken() string

Jump to

Keyboard shortcuts

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