envfile

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractPostgresURL

func ExtractPostgresURL(output string) string

ExtractPostgresURL finds a postgres URL substring in output, returning the first match. It returns empty string if none is found.

func RedactBytes

func RedactBytes(b []byte) string

Byte-safe helper for cases where external tools return non-UTF8.

func RedactText

func RedactText(s string) string

RedactText removes common secret-bearing substrings from logs and CLI output. It is intentionally conservative: it may over-redact.

func UpsertFile

func UpsertFile(path string, updates []Update) error

UpsertFile updates (or creates) a dotenv-style file at path, preserving unrelated lines and comments. Updated keys are written using a quoted value.

File permissions are enforced to 0600.

Types

type Summary

type Summary struct {
	Host     string
	Database string
}

Summary describes a connection string without including secrets.

func SummarizePostgresURL

func SummarizePostgresURL(raw string) Summary

SummarizePostgresURL extracts host and database name from a postgres URL. If parsing fails, it returns an empty summary.

func (Summary) String

func (s Summary) String() string

type Update

type Update struct {
	Key     string
	Value   string
	Comment string
}

Jump to

Keyboard shortcuts

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