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 ¶
- func Exists(fileName string) bool
- func WriteConfig(fileName string, data []byte) error
- type Config
- func (c *Config) DeleteComposite(id string)
- func (c *Config) DeleteConnection(connID string)
- func (c *Config) DeleteImportRequest(importID string)
- func (c *Config) DeleteRead(readID string)
- func (c *Config) DeleteRelay(relayID string)
- func (c *Config) DeleteSchema(schemaID string)
- func (c *Config) DeleteService(schemaID string)
- func (c *Config) DeleteValidation(validationID string)
- func (c *Config) GetComposite(id string) *opts.Composite
- func (c *Config) GetConnection(connID string) *opts.ConnectionOptions
- func (c *Config) GetImportRequest(importID string) *protos.ImportGithubRequest
- func (c *Config) GetRead(readID string) *stypes.Read
- func (c *Config) GetRelay(relayID string) *stypes.Relay
- func (c *Config) GetSchema(schemaID string) *protos.Schema
- func (c *Config) GetService(serviceID string) *protos.Service
- func (c *Config) GetValidation(validationID string) *common.Validation
- func (c *Config) Save() error
- func (c *Config) SetComposite(id string, comp *opts.Composite)
- func (c *Config) SetConnection(connID string, conn *opts.ConnectionOptions)
- func (c *Config) SetImportRequest(importID string, importSchema *protos.ImportGithubRequest)
- func (c *Config) SetRead(readID string, read *stypes.Read)
- func (c *Config) SetRelay(relayID string, relay *stypes.Relay)
- func (c *Config) SetSchema(schemaID string, schema *protos.Schema)
- func (c *Config) SetService(serviceID string, svc *protos.Service)
- func (c *Config) SetValidation(validationID string, conn *common.Validation)
- type IConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteConfig ¶
WriteConfig writes a Batch struct as JSON into a config.json file
Types ¶
type Config ¶
type Config struct { PlumberID string `json:"plumber_id"` Token string `json:"token"` TeamID string `json:"team_id"` UserID string `json:"user_id"` VCServiceToken string `json:"vc_service_token"` // entire vc-service JWT GitHubToken string `json:"github_bearer_token"` // retrieved from vc-service JWT contents GitHubInstallID int64 `json:"install_id"` Connections map[string]*opts.ConnectionOptions `json:"-"` Relays map[string]*stypes.Relay `json:"-"` Schemas map[string]*protos.Schema `json:"-"` Services map[string]*protos.Service `json:"-"` Reads map[string]*stypes.Read `json:"-"` ImportRequests map[string]*protos.ImportGithubRequest `json:"-"` Validations map[string]*common.Validation `json:"-"` Composites map[string]*opts.Composite `json:"-"` ConnectionsMutex *sync.RWMutex `json:"-"` ServicesMutex *sync.RWMutex `json:"-"` ReadsMutex *sync.RWMutex `json:"-"` RelaysMutex *sync.RWMutex `json:"-"` SchemasMutex *sync.RWMutex `json:"-"` ImportRequestsMutex *sync.RWMutex `json:"-"` ValidationsMutex *sync.RWMutex `json:"-"` CompositesMutex *sync.RWMutex `json:"-"` }
Config stores Account IDs and the auth_token cookie
func ReadConfig ¶
ReadConfig reads a config JSON file into a Config struct
func (*Config) DeleteComposite ¶
DeleteComposite removes a schema validation from in-memory map
func (*Config) DeleteConnection ¶
DeleteConnection removes a connection from in-memory map
func (*Config) DeleteImportRequest ¶
func (*Config) DeleteRead ¶
DeleteRead removes a read from in-memory map
func (*Config) DeleteRelay ¶
DeleteRelay removes a service from in-memory map
func (*Config) DeleteSchema ¶
DeleteSchema removes a schema from in-memory map
func (*Config) DeleteService ¶
DeleteService removes a service from in-memory map
func (*Config) DeleteValidation ¶
DeleteValidation removes a schema validation from in-memory map
func (*Config) GetComposite ¶
GetComposite retrieves a schema validation from in-memory map
func (*Config) GetConnection ¶
func (c *Config) GetConnection(connID string) *opts.ConnectionOptions
GetConnection retrieves a connection from in-memory map
func (*Config) GetImportRequest ¶
func (c *Config) GetImportRequest(importID string) *protos.ImportGithubRequest
func (*Config) GetService ¶
GetService returns a service from the in-memory map
func (*Config) GetValidation ¶
func (c *Config) GetValidation(validationID string) *common.Validation
GetValidation retrieves a schema validation from in-memory map
func (*Config) Save ¶
Save is a convenience method of persisting the config to disk via a single call
func (*Config) SetComposite ¶
SetComposite saves a schema validation to in-memory map
func (*Config) SetConnection ¶
func (c *Config) SetConnection(connID string, conn *opts.ConnectionOptions)
SetConnection saves a connection to in-memory map
func (*Config) SetImportRequest ¶
func (c *Config) SetImportRequest(importID string, importSchema *protos.ImportGithubRequest)
func (*Config) SetService ¶
SetService saves a service to in-memory map
func (*Config) SetValidation ¶
func (c *Config) SetValidation(validationID string, conn *common.Validation)
SetValidation saves a schema validation to in-memory map