configfetcher

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: Unlicense Imports: 9 Imported by: 0

README

Config Fetcher

Installation

go get -u github.com/jamesattensure/configfetcher

Documentation

Overview

Package configfetcher provides a simple abstraction to fetch config values from a file or GCP Secrets Manager to populate a struct.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	ConfigData []byte
	GcloudVars
	ConfigStruct interface{}
}

Data contains everything needed to interact with this abstraction

func (*Data) GetConfigStruct added in v0.2.0

func (d *Data) GetConfigStruct(configType string) error

GetConfigStruct populates the Data.ConfigStruct interface with the data from Data.ConfigData It expects either `ReadGCPSMSecret()` or `ReadFile()` has been ran to populate Data.ConfigData

func (*Data) ReadFile added in v0.2.0

func (d *Data) ReadFile(filePath string) (*Data, error)

ReadFile returns the Data struct after attempting to read the data from a file

func (*Data) ReadGCPSMSecret added in v0.2.0

func (d *Data) ReadGCPSMSecret() (*Data, error)

ReadGCPSMSecret returns the Data struct and error after attempting to fetch the environment variables:

`PROJECT_ID`      required
`SECRET_NAME`     required
`SECRET_VERSION`  optional

type GcloudVars added in v0.2.0

type GcloudVars struct {
	ProjectID     string
	SecretName    string
	SecretVersion string
}

GcloudVars contains the data needed to connect to GCP Secret Manager

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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