confloader

package module
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: MIT Imports: 7 Imported by: 0

README

confloader

Desciprtion

Confloader는 Configure를 로드 하기 위해 간단히 작성된 패키지 입니다. 파일을 로드하여 설정을 반환하거나, AWS SSM Parameter Store의 값을 읽고 설정을 반환 합니다.

Installation

패키지 설치 구문은 아래와 같습니다.

go get github.com/sizzlei/confloader

Configure Example

Configure 파일 또는 Parameter Store의 내용은 아래 규격을 기준으로 합니다.

Param:  
  - ConfigId : {Configure Name}
    Conf:
      {conf_name} : {conf_value}
      {conf_name} : {conf_value}
      .
      .
      .

  - ConfigId : {Configure Name}
    Conf:
      {conf_name} : {conf_value}
      .
      .
      .

Struct

Struct는 Interface로 로드합니다.

  type Param struct {
    Param		[]Conf 				`yaml:"Param"`
  }

  type Conf struct {
    ConfId		string					`yaml:"ConfigId"`
    Conf 		map[string]interface{} 	`yaml:"Conf"`
  }

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AWSSecretLoader added in v0.1.5

func AWSSecretLoader(r string, k string) (map[string]interface{}, error)

func InterfaceToSlice added in v0.1.4

func InterfaceToSlice(i interface{}) []string

Types

type Conf

type Conf struct {
	ConfId string                 `yaml:"ConfigId"`
	Conf   map[string]interface{} `yaml:"Conf"`
}

type Param

type Param struct {
	Param []Conf `yaml:"Param"`
}

func AWSParamLoader

func AWSParamLoader(r string, k string) (Param, error)

func FileLoader

func FileLoader(p string) (Param, error)

func (Param) Conflist added in v0.1.2

func (p Param) Conflist() []string

func (Param) Keyload added in v0.1.1

func (p Param) Keyload(k string) map[string]interface{}

Jump to

Keyboard shortcuts

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