envprops

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: MIT Imports: 5 Imported by: 0

README

envprops f12

Enprops can be used for containerized applications that use a properties file and expect it to present on a writable volume. This approach does not go well with running the container on Kubernetes and using ConfigMaps and Secrets to inject the configuration.

Enprops fixes this by reading a properties file, convert the property names to environment variable names read the environment variable to set the value of the property.

Typical use in Dockerfile

FROM golang:alpine AS envprops

RUN go install github.com/myhops/envprops/cmd/envprops@latest 

# Install envprops

FROM not-so-clever-image

# Copy envprops
COPY --from envprops /go/bin/envprops /opt/envprops/

# Modify the entrypoint or cmd
ENTRYPOINT ["/opt/envprops"]

CMD [""]

Commandline options

TODO

  • Create Dockerfile from base image info

Design

Create dockerfile from base image into

Subcommand for envprops dockerfile. It accepts the inspect from stdin and write a modified dockerfile to stdout.

The dockerfile prefixes the envprop build stage and modifies the entrypoint and cmd.

envprops creates and writes the properties file and then execs the original entrypoint and command.

docker inspect baseimage | envprops gen-dockerfile 

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFormatError = fmt.Errorf("format error")
)

Functions

func EnvVarName

func EnvVarName(name string, prefix ...string) string

func PropertyLine

func PropertyLine(p Property, prefix ...string) string

func PropertyLineEnv

func PropertyLineEnv(p Property, getenv func(string) string, prefix ...string) string

func WriteProperties

func WriteProperties(w io.Writer, props []*Property) error

Types

type Property

type Property struct {
	Key   string
	Value string
}

func ReadProperties

func ReadProperties(r io.Reader) ([]*Property, error)

func (Property) EnvVarName

func (p Property) EnvVarName(prefix ...string) string

Directories

Path Synopsis
cli
cmd
cmd
f12 command
gotpl command

Jump to

Keyboard shortcuts

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