secretfile

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package secretfile resolves values from files mounted as Docker secrets.

The *_FILE env var convention is the pattern used by Postgres, MySQL, Redis, and other Docker Official Images to source sensitive values from files (typically /run/secrets/*) rather than inline env vars — keeping them out of process environments and `docker inspect` output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OverrideDSNPassword

func OverrideDSNPassword(dsn, pwFile string) (string, error)

OverrideDSNPassword returns dsn with its password component replaced by the contents of the file at pwFile. When pwFile is empty, dsn is returned unchanged. The password is URL-encoded by url.UserPassword, so callers may store raw special characters in the secret file.

Returns an error if dsn is not a URL-style DSN or has no user component.

func Read

func Read(path string) (string, error)

Read returns the contents of the file at path with trailing whitespace trimmed. Empty path returns an empty string and no error so callers can pass an unset env var through without branching.

Types

This section is empty.

Jump to

Keyboard shortcuts

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