config

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

internal/config/profile.go

Index

Constants

View Source
const DefaultEndpoint = "api.nweb.app:443"

Variables

This section is empty.

Functions

func DefaultConfigPath

func DefaultConfigPath() string

Types

type Config

type Config struct {
	ActiveProfile string             `yaml:"active_profile"`
	Profiles      map[string]Profile `yaml:"profiles"`
}

func Load

func Load(path string) (*Config, error)

func (*Config) ActiveProfileData

func (c *Config) ActiveProfileData(name string) Profile

ActiveProfileData returns the profile for the given name (or c.ActiveProfile if empty).

func (*Config) ResolveProfileName

func (c *Config) ResolveProfileName(name string) string

ResolveProfileName returns the effective profile name, falling back to ActiveProfile and then "default" when name is empty.

func (*Config) Save

func (c *Config) Save(path string) error

func (*Config) SetProfile

func (c *Config) SetProfile(name string, p Profile)

SetProfile upserts a profile.

type Profile

type Profile struct {
	Endpoint     string    `yaml:"endpoint"`
	WorkspaceID  string    `yaml:"workspace_id,omitempty"`
	CachedJWT    string    `yaml:"cached_jwt,omitempty"`
	JWTExpiresAt time.Time `yaml:"jwt_expires_at,omitempty"`
}

Jump to

Keyboard shortcuts

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