env

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package env loads environment variable files:

http-client.env.json          {"dev": {"baseUrl": "..."}, "$shared": {...}}
http-client.private.env.json  same shape, for secrets, gitignored
.env                          KEY=value lines

These are the conventions used by JetBrains HTTP Client, kulala.nvim and httpyac, so one set of files serves every tool.

Index

Constants

View Source
const (
	PublicFile  = "http-client.env.json"
	PrivateFile = "http-client.private.env.json"
	DotEnvFile  = ".env"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Environments

type Environments struct {
	Public  map[string]map[string]string // env name -> vars
	Private map[string]map[string]string
	DotEnv  map[string]string
	Found   []string // files that were present
}

Environments is everything loaded from the env files of a project.

func Load

func Load(root string) (*Environments, error)

Load reads the env files in root. Missing files are fine.

func (*Environments) Has

func (e *Environments) Has(name string) bool

Has reports whether an environment is declared in either JSON file.

func (*Environments) Names

func (e *Environments) Names() []string

Names returns the environment names found in the JSON files, sorted.

func (*Environments) PrivateVars

func (e *Environments) PrivateVars(env string) map[string]string

PrivateVars returns the private vars for env merged over $shared.

func (*Environments) PublicVars

func (e *Environments) PublicVars(env string) map[string]string

PublicVars returns the public vars for env merged over $shared.

Jump to

Keyboard shortcuts

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