Documentation
¶
Overview ¶
Copyright © 2025 Vapi, Inc.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Authors:
Dan Goosewin <[email protected]>
Index ¶
- func SaveConfig(config *Config) error
- func SetConfig(config *Config)
- type Account
- type Config
- func (c *Config) AddAccount(accountKey, apiKey, organization, orgID, email string)
- func (c *Config) GetAPIBaseURL() string
- func (c *Config) GetAPIKeySource() string
- func (c *Config) GetActiveAPIKey() string
- func (c *Config) GetActiveAccount() *Account
- func (c *Config) GetDashboardURL() string
- func (c *Config) GetEnvironment() string
- func (c *Config) IsProduction() bool
- func (c *Config) ListAccounts() map[string]Account
- func (c *Config) RemoveAccount(accountKey string) error
- func (c *Config) SetActiveAccount(accountKey string) error
- type Environment
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SaveConfig ¶
Types ¶
type Account ¶ added in v0.1.2
type Account struct {
APIKey string `mapstructure:"apikey"`
Organization string `mapstructure:"organization,omitempty"` // Organization name if available
OrgID string `mapstructure:"org_id,omitempty"` // Organization ID for reliable deduplication
Environment string `mapstructure:"environment,omitempty"` // Per-account environment override
LoginTime string `mapstructure:"logintime,omitempty"` // When this account was last authenticated
Email string `mapstructure:"email,omitempty"` // User email if available
}
Account represents a single authenticated account/organization
type Config ¶
type Config struct {
APIKey string `mapstructure:"api_key"` // Legacy single API key (for backward compatibility)
BaseURL string `mapstructure:"base_url"`
DashboardURL string `mapstructure:"dashboard_url"`
Environment string `mapstructure:"environment"`
Timeout int `mapstructure:"timeout"`
DisableAnalytics bool `mapstructure:"disable_analytics"`
Accounts map[string]Account `mapstructure:"accounts"` // Multiple accounts support
ActiveAccount string `mapstructure:"active_account"` // Which account is currently active
}
func GetConfig ¶ added in v0.0.8
func GetConfig() *Config
GetConfig returns the global configuration instance
func LoadConfig ¶
func (*Config) AddAccount ¶ added in v0.1.2
AddAccount adds a new account or updates an existing one
func (*Config) GetAPIBaseURL ¶ added in v0.0.2
GetAPIBaseURL returns the API base URL, respecting environment overrides
func (*Config) GetAPIKeySource ¶ added in v0.1.2
GetAPIKeySource returns where the current API key comes from
func (*Config) GetActiveAPIKey ¶ added in v0.1.2
GetActiveAPIKey returns the API key for the currently active account
func (*Config) GetActiveAccount ¶ added in v0.1.2
GetActiveAccount returns the currently active account
func (*Config) GetDashboardURL ¶ added in v0.0.2
GetDashboardURL returns the dashboard URL, respecting environment overrides
func (*Config) GetEnvironment ¶ added in v0.0.2
GetEnvironment returns the current environment name
func (*Config) IsProduction ¶ added in v0.0.2
IsProduction returns true if running against production environment
func (*Config) ListAccounts ¶ added in v0.1.2
ListAccounts returns all configured accounts
func (*Config) RemoveAccount ¶ added in v0.1.2
RemoveAccount removes an account
func (*Config) SetActiveAccount ¶ added in v0.1.2
SetActiveAccount switches to the specified account
type Environment ¶ added in v0.0.2
Environment configuration