config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Regions = map[string]RegionConfig{
	"us": {
		AccountsServer: "https://accounts.zoho.com",
		APIBase:        "https://www.zohoapis.com",
		MailBase:       "https://mail.zoho.com",
	},
	"eu": {
		AccountsServer: "https://accounts.zoho.eu",
		APIBase:        "https://www.zohoapis.eu",
		MailBase:       "https://mail.zoho.eu",
	},
	"in": {
		AccountsServer: "https://accounts.zoho.in",
		APIBase:        "https://www.zohoapis.in",
		MailBase:       "https://mail.zoho.in",
	},
	"au": {
		AccountsServer: "https://accounts.zoho.com.au",
		APIBase:        "https://www.zohoapis.com.au",
		MailBase:       "https://mail.zoho.com.au",
	},
	"jp": {
		AccountsServer: "https://accounts.zoho.jp",
		APIBase:        "https://www.zohoapis.jp",
		MailBase:       "https://mail.zoho.jp",
	},
	"ca": {
		AccountsServer: "https://accounts.zohocloud.ca",
		APIBase:        "https://www.zohoapis.ca",
		MailBase:       "https://mail.zohocloud.ca",
	},
	"sa": {
		AccountsServer: "https://accounts.zoho.sa",
		APIBase:        "https://www.zohoapis.sa",
		MailBase:       "https://mail.zoho.sa",
	},
	"uk": {
		AccountsServer: "https://accounts.zoho.uk",
		APIBase:        "https://www.zohoapis.uk",
		MailBase:       "https://mail.zoho.uk",
	},
}

Regions maps region codes to their endpoint configurations Covers all 8 Zoho data centers

Functions

func CacheDir

func CacheDir() string

CacheDir returns the XDG-compliant cache directory for zoh Typically ~/.cache/zoh/ on Linux (for token cache in Plan 02)

func ConfigDir

func ConfigDir() string

ConfigDir returns the XDG-compliant config directory for zoh Typically ~/.config/zoh/ on Linux

func ConfigPath

func ConfigPath() string

ConfigPath returns the full path to the config file

func DataDir

func DataDir() string

DataDir returns the XDG-compliant data directory for zoh Typically ~/.local/share/zoh/ on Linux (for future use)

func ValidRegions

func ValidRegions() []string

ValidRegions returns a sorted list of valid region codes

Types

type Config

type Config struct {
	Region        string `json:"region"`
	ClientID      string `json:"client_id,omitempty"`
	ClientSecret  string `json:"client_secret,omitempty"`
	OrgID         string `json:"org_id,omitempty"`
	AccountID     string `json:"account_id,omitempty"`
	DefaultOutput string `json:"default_output,omitempty"`
}

Config holds the CLI configuration

func Load

func Load() (*Config, error)

Load reads config from XDG path, returns defaults if file doesn't exist

func (*Config) Get

func (c *Config) Get(key string) (string, error)

Get retrieves a config value by key name

func (*Config) GetRegionConfig

func (c *Config) GetRegionConfig() (RegionConfig, error)

GetRegionConfig returns the RegionConfig for the configured region

func (*Config) Save

func (c *Config) Save() error

Save writes the config to the XDG config path

func (*Config) Set

func (c *Config) Set(key, value string) error

Set sets a config value by key name and saves

func (*Config) Unset

func (c *Config) Unset(key string) error

Unset sets a config value to its zero value and saves

type RegionConfig

type RegionConfig struct {
	AccountsServer string
	APIBase        string
	MailBase       string
}

RegionConfig holds the endpoint URLs for a Zoho data center

func GetRegion

func GetRegion(name string) (RegionConfig, error)

GetRegion returns the configuration for the specified region

Jump to

Keyboard shortcuts

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