profile

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package profile defines the core profile structure and environment variable handling. It provides functionality for converting profiles to environment configurations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Stringify

func Stringify(v any) (string, error)

Stringify turns any Go value into the dotenv-ready string described earlier.

  • Scalars → plain strings (`true`, `5432`, `foo`…).
  • Slices / maps / structs → compact JSON wrapped in single quotes (`'["a","b"]'`, `'{"k":"v"}'`).

Types

type Env

type Env map[string]any

Env is a map of environment variable names to their non-stringified values.

func (*Env) FromEnv added in v0.0.2

func (e *Env) FromEnv(env env.Env)

FromEnv initializes Env from an env.Env.

func (*Env) Stringified added in v0.0.1

func (e *Env) Stringified() (env.Env, error)

Stringified serializes Env into env.Env using Stringify. – Scalars pass through unchanged. – Non-scalars are JSON-minified and single-quoted (see Stringify).

func (*Env) UnmarshalYAML added in v0.0.2

func (e *Env) UnmarshalYAML(node ast.Node) error

UnmarshalYAML allows Env to be unmarshaled as its regular type or a sequence of strings.

type Profile

type Profile struct {
	// Env is a collection of environment variables.
	Env Env `toml:"env,omitempty" yaml:"env,omitempty"`
	// Extends is a list of references to other places to extend from.
	Extends extends.Extends `toml:"extends,omitempty" yaml:"extends,omitempty"`
	// Output is the desired output file.
	Output string `toml:"output,omitempty" yaml:"output,omitempty"`
	// Default indicates whether this profile is the default one.
	Default bool `toml:"default,omitempty" yaml:"default,omitempty"`
}

Profile represents a configuration profile with environment variables and metadata.

func (*Profile) ToEnv

func (p *Profile) ToEnv(name string) (environment.Environment, error)

ToEnv converts the profile to an environment representation, stringifying the environment variables.

Jump to

Keyboard shortcuts

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