osenv

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package osenv provides the process-backed env.Reader/env.Writer: real environment variables, falling back to a .env file, plus CLI argument lookup. This is the concrete implementation a server binary injects — it imports "os" on purpose, so it never compiles into a wasm/edge binary that only ever injects a platform-specific Reader instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Arg

func Arg(key string) string

Arg returns the value for -key=value or -key value in os.Args (skipping argv[0]). Unset flags return "" — callers apply their own default. There is no edge/wasm equivalent: a Cloudflare Worker has no argv, so this stays osenv-only rather than living in the agnostic env package.

func Reader

func Reader() env.Reader

Reader returns an env.Reader backed by the process environment, falling back to a .env file in the working directory when a key is unset.

func ReaderFrom

func ReaderFrom(path string) env.Reader

ReaderFrom is Reader with an explicit .env path, for callers not running from the project root.

func Writer

func Writer() env.Writer

Writer returns an env.Writer that sets key in the current process's own environment (os.Setenv) — it does not persist to a .env file, and it only affects this process, not its parent or children already started.

Types

This section is empty.

Jump to

Keyboard shortcuts

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