osx

package
v0.0.322 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: Apache-2.0 Imports: 7 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetenvDefault

func GetenvDefault(key string, def string) string

GetenvDefault returns an environment variable or the default value if it is empty.

func ReadFileFromAllSources added in v0.0.322

func ReadFileFromAllSources(source string, opts ...Option) (bytes []byte, err error)

ReadFileFromAllSources reads a file from base64, http, https, and file sources.

Using options, you can disable individual loaders. For example, the following will return an error:

ReadFileFromAllSources("https://foo.bar/baz.txt", WithDisableHTTPLoader())

Possible formats are:

- file:///path/to/file - https://host.com/path/to/file - http://host.com/path/to/file - base64://<base64 encoded string>

For more options, check:

- WithDisableFileLoader - WithDisableHTTPLoader - WithDisableBase64Loader - WithBase64Encoding - WithHTTPClient

Types

type Option added in v0.0.322

type Option func(o *options)

func WithBase64Encoding added in v0.0.322

func WithBase64Encoding(enc *base64.Encoding) Option

WithBase64Encoding sets the base64 encoding.

func WithDisableBase64Loader added in v0.0.322

func WithDisableBase64Loader() Option

WithDisableBase64Loader disables the base64 loader.

func WithDisableFileLoader added in v0.0.322

func WithDisableFileLoader() Option

WithDisableFileLoader disables the file loader.

func WithDisableHTTPLoader added in v0.0.322

func WithDisableHTTPLoader() Option

WithDisableHTTPLoader disables the HTTP loader.

func WithHTTPClient added in v0.0.322

func WithHTTPClient(hc *retryablehttp.Client) Option

WithHTTPClient sets the HTTP client.

Jump to

Keyboard shortcuts

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