Skip to content

ayatmaulana/doppler-go-runtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Doppler Go Runtime

Doppler is a secret management that I use as an alternative to Hashicorp Vautl, because it is free and can be used for small and medium projects.

But for now there is no golang package to use Doppler directly in our Golang Application Runtime, for that this package was created.

🍱  Prerequesites

Here's what you have to prepare

🚀  Installation

$ go get github.com/ayatmaulana/doppler-go-runtime

🌴  Usage

Before you use this package, make sure you have an doppler.yaml file in your root project folder with this content (ref: https://docs.doppler.com/docs/project-templates)

setup:
  project: your-project-name
  config: your-config-name

this package will auto discover your doppler.yaml file and use it to getting secret to Doppler Server

package main

import (
	"log"
	"os"

	"github.com/ayatmaulana/doppler-go-runtime"
)

func main(){
  doppler := dopplergoruntime.NewDopplerRuntime(dopplergoruntime.DopplerRuntimeConfig{
    Token: os.Getenv("DOPPLER_TOKEN"),
  })

  if err := doppler.Load(); err != nil {
    log.Println(err)
  }
}

if you want set the project and config programmatically you can also use the parameter

package main

import (
	"log"
	"os"

	"github.com/ayatmaulana/doppler-go-runtime"
)

func main(){
  doppler := dopplergoruntime.NewDopplerRuntime(dopplergoruntime.DopplerRuntimeConfig{
    Token: os.Getenv("DOPPLER_TOKEN"),
    Project: "your-project",
    Config: "your-config"
  })

  if err := doppler.Load(); err != nil {
    log.Println(err)
  }
}

and run with your Doppler Service Token like This

$ DOPPLER_TOKEN="dp.st.dev_xxxxxxxxxxxxxxxxx" go run main.go

💽  Options

  • Token - string
  • Project - string
  • Config - string
  • EnableDebug - boolean

🤝  Found a bug? Missing a specific feature?

Feel free to file a new issue with a respective title and description. If you already found a solution to your problem, we would love to review your pull request!.

📘  License

This package is released under the under terms of the GNU GENERAL PUBLIC LICENSE .