envutil

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package envutil parses KEY=VALUE env blobs shared by the deploy engine, databases, and the web Variables tab. Values may span multiple lines when wrapped in single or double quotes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Inject

func Inject(env, key, val string) (string, string)

Inject sets key=val in a KEY=VALUE blob and returns the new blob plus the var name actually used. If key already holds val it's a no-op (idempotent). If key holds a DIFFERENT value it is NOT clobbered, the var is added under a free suffix (key_2, key_3…) so an existing value for another consumer survives.

func Lines

func Lines(s string) []string

Lines returns the pairs as "KEY=VALUE" strings for container specs.

Types

type Var

type Var struct {
	Key   string
	Value string
}

Var is one parsed KEY=VALUE pair, in source order.

func Parse

func Parse(s string) []Var

Parse splits a KEY=VALUE-per-line blob into pairs, skipping blanks and comments. A value opening with ' or " may span lines until the closing quote; surrounding quotes are stripped. no escape sequences (\n, \") inside quotes, literal text only.

Jump to

Keyboard shortcuts

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