config

package
v0.2.37 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ComponentDefaultsFileName is the name of the component defaults file
	// This follows copier's data_file convention
	ComponentDefaultsFileName = ".copier-answers-defaults.yaml"
	// LegacyComponentDefaultsFileName is the old name for backward compatibility
	LegacyComponentDefaultsFileName = "component-defaults.yaml"
)
View Source
const (
	DataRobotURL    = "endpoint"
	DataRobotAPIKey = "token"
)

Variables

View Source
var ErrInvalidURL = errors.New("Invalid URL.")

Functions

func CreateConfigFileDirIfNotExists

func CreateConfigFileDirIfNotExists() error

func DebugViperConfig added in v0.1.7

func DebugViperConfig() (string, error)

func GetAPIKey

func GetAPIKey() (string, error)

func GetBaseURL

func GetBaseURL() string

func GetEndpointURL

func GetEndpointURL(endpoint string) (string, error)

func GetUserAgentHeader added in v0.2.13

func GetUserAgentHeader() string

func ReadConfigFile

func ReadConfigFile(filePath string) error

func RedactedReqInfo added in v0.2.13

func RedactedReqInfo(req *http.Request) string

func SaveURLToConfig

func SaveURLToConfig(newURL string) error

func SchemeHostOnly added in v0.2.7

func SchemeHostOnly(longURL string) (string, error)

SchemeHostOnly takes a URL like: https://app.datarobot.com/api/v2 and just returns https://app.datarobot.com (no trailing slash)

func VerifyToken added in v0.2.7

func VerifyToken(datarobotEndpoint, token string) error

VerifyToken verifies if the datarobot endpoint + api key pair correspond to a valid pair.

Types

type ComponentDefaults added in v0.2.26

type ComponentDefaults struct {
	Defaults map[string]map[string]interface{} `yaml:"defaults"`
}

ComponentDefaults holds default answers for copier templates The structure maps component repo URLs to their default answers This follows copier's data_file semantics but supports multiple repos

func LoadComponentDefaults added in v0.2.26

func LoadComponentDefaults(explicitPath string) (*ComponentDefaults, error)

LoadComponentDefaults reads the component defaults configuration file Priority order: 1. Explicitly provided path (if not empty) 2. .datarobot/.copier-answers-defaults.yaml in repo root 3. ~/.config/datarobot/.copier-answers-defaults.yaml 4. ~/.config/datarobot/component-defaults.yaml (legacy) Returns an empty config if no file exists

func (*ComponentDefaults) GetDefaultsForRepo added in v0.2.26

func (c *ComponentDefaults) GetDefaultsForRepo(repoURL string) map[string]interface{}

GetDefaultsForRepo returns the default answers for a specific repository URL Returns an empty map if no defaults are configured

func (*ComponentDefaults) MergeWithCLIData added in v0.2.26

func (c *ComponentDefaults) MergeWithCLIData(repoURL string, cliData map[string]interface{}) map[string]interface{}

MergeWithCLIData merges configured defaults with CLI-provided --data arguments CLI arguments take precedence over defaults

Jump to

Keyboard shortcuts

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