osx

package
v0.0.574 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: Apache-2.0 Imports: 8 Imported by: 5

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", WithDisabledHTTPLoader())

Possible formats are:

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

For more options, check:

- WithDisabledFileLoader - WithDisabledHTTPLoader - WithDisabledBase64Loader - WithBase64Encoding - WithHTTPClient

func RestrictedReadFile added in v0.0.323

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

RestrictedReadFile works similar to ReadFileFromAllSources but has all sources disabled per default. You need to enable the loaders you wish to use explicitly.

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 WithDisabledBase64Loader added in v0.0.323

func WithDisabledBase64Loader() Option

WithDisabledBase64Loader disables the base64 loader.

func WithDisabledFileLoader added in v0.0.323

func WithDisabledFileLoader() Option

WithDisabledFileLoader disables the file loader.

func WithDisabledHTTPLoader added in v0.0.323

func WithDisabledHTTPLoader() Option

WithDisabledHTTPLoader disables the HTTP loader.

func WithEnabledBase64Loader added in v0.0.323

func WithEnabledBase64Loader() Option

WithEnabledBase64Loader disables the base64 loader.

func WithEnabledFileLoader added in v0.0.323

func WithEnabledFileLoader() Option

WithEnabledFileLoader enables the file loader.

func WithEnabledHTTPLoader added in v0.0.323

func WithEnabledHTTPLoader() Option

WithEnabledHTTPLoader enables the HTTP loader.

func WithHTTPClient added in v0.0.322

func WithHTTPClient(hc *retryablehttp.Client) Option

WithHTTPClient sets the HTTP client.

func WithoutResilientBase64Encoding added in v0.0.355

func WithoutResilientBase64Encoding() Option

WithoutResilientBase64Encoding sets the base64 encoding.

Jump to

Keyboard shortcuts

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