env

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read

func Read(key string) (string, error)

Read retrieves the value of the environment variable named by the key. As an alternative to passing sensitive information via environment variables, _FILE may be appended to the previously listed environment variables, causing the initialization script to load the values for those variables from files present in the container. In particular, this can be used to load passwords from Docker secrets stored in /run/secrets/<secret_name> files.

https://docs.docker.com/engine/swarm/secrets/ https://docs.docker.com/compose/compose-file/compose-versioning/#version-31

docker-compose.yml ------------------ version: "3.1"

secrets:

mypassword:
  external: true

services:

app:
  image: your-app-in-docker-image
  environment:
    - PASSWORD_FILE=/run/secrets/mypassword
    - LOGIN=mylogin

EXAMPLE:

passwd, _ := env.Read("PASSWORD") // reading from PASSWORD_FILE login, _ := end.Read("LOGIN") // reading from LOGIN.

Types

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

func Once

func Once(f ...daemon.WatcherConfigFunc) *Watcher

Once .

func (*Watcher) Read

func (w *Watcher) Read() error

Jump to

Keyboard shortcuts

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