ssmenv

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

README

This module lets you use values in AWS Parameter Store as environmental variables without modifying your code (other than importing this module).

Usage Example

Say you have an app like so:

package main

import (
  "os"
  _ "github.com/oxplot/ssmenv/autoload"
)

func main() {
  token := os.Getenv("GITHUB_TOKEN")
  // Call some github APIs
}

Let's assume you want to run this code under AWS Lambda but don't want to specify the token in plain text for security reasons. With this module imported, you can specify the SSM Parameter's ARN as the value of GITHUB_TOKEN env var:

export GITHUB_TOKEN=arn:aws:ssm:us-west-2:1234567890:parameter/github_token

Provided you have assigned appropriate IAM permissions to allow reading the above parameter from your lambda function, value of GITHUB_TOKEN env var will be set automatically without any other change to the code.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load() error

func LoadWithSession

func LoadWithSession(sess *session.Session) error

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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