Documentation ¶
Overview ¶
Package config is used for storing and manipulating (server) state in plumber. There should be, at most, a single instance of the plumber config that is passed around between various components.
Index ¶
- Constants
- type Config
- func (c *Config) DeleteConnection(connID string)
- func (c *Config) DeleteRelay(relayID string)
- func (c *Config) DeleteTunnel(tunnelID string)
- func (c *Config) GetConnection(connID string) *stypes.Connection
- func (c *Config) GetRelay(relayID string) *stypes.Relay
- func (c *Config) GetTunnel(tunnelID string) *stypes.Tunnel
- func (c *Config) Save() error
- func (c *Config) SetConnection(connID string, conn *stypes.Connection)
- func (c *Config) SetRelay(relayID string, relay *stypes.Relay)
- func (c *Config) SetTunnel(tunnelID string, tunnel *stypes.Tunnel)
- func (c *Config) Update(cfg *Config) error
Constants ¶
const ( ConfigFilename = "config.json" KVConfigBucket = "plumber" KVConfigKey = "persistent-config" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ClusterID string `json:"-"` // This comes from an environment variable PlumberID string `json:"plumber_id"` Token string `json:"token"` TeamID string `json:"team_id"` UserID string `json:"user_id"` Connections map[string]*stypes.Connection `json:"connections"` Relays map[string]*stypes.Relay `json:"relays"` Tunnels map[string]*stypes.Tunnel `json:"tunnels"` ConnectionsMutex *sync.RWMutex `json:"-"` RelaysMutex *sync.RWMutex `json:"-"` TunnelsMutex *sync.RWMutex `json:"-"` // contains filtered or unexported fields }
Config stores Account IDs and the auth_token cookie
func New ¶ added in v1.3.0
New will attempt to fetch and return an existing config from either NATS or the local disk. If neither are available, it will return a new config.
func (*Config) DeleteConnection ¶
DeleteConnection removes a connection from in-memory map
func (*Config) DeleteRelay ¶
DeleteRelay removes a service from in-memory map
func (*Config) DeleteTunnel ¶ added in v1.4.0
DeleteTunnel removes a tunnel from in-memory map
func (*Config) GetConnection ¶
func (c *Config) GetConnection(connID string) *stypes.Connection
GetConnection retrieves a connection from in-memory map
func (*Config) GetTunnel ¶ added in v1.4.0
GetTunnel returns an in-progress read from the Tunnels map
func (*Config) SetConnection ¶
func (c *Config) SetConnection(connID string, conn *stypes.Connection)
SetConnection saves a connection to in-memory map