Documentation
      ¶
    
    
  
    
  
    Index ¶
- func GetenvDefault(key string, def string) string
 - func ReadFileFromAllSources(source string, opts ...Option) (bytes []byte, err error)
 - func RestrictedReadFile(source string, opts ...Option) (bytes []byte, err error)
 - type Option
 - func WithBase64Encoding(enc *base64.Encoding) Option
 - func WithDisabledBase64Loader() Option
 - func WithDisabledFileLoader() Option
 - func WithDisabledHTTPLoader() Option
 - func WithEnabledBase64Loader() Option
 - func WithEnabledFileLoader() Option
 - func WithEnabledHTTPLoader() Option
 - func WithHTTPClient(hc *retryablehttp.Client) Option
 
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetenvDefault ¶
GetenvDefault returns an environment variable or the default value if it is empty.
func ReadFileFromAllSources ¶ added in v0.0.322
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:
- 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
Types ¶
type Option ¶ added in v0.0.322
type Option func(o *options)
func WithBase64Encoding ¶ added in v0.0.322
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.