Categorygithub.com/lanceplarsen/go-vault-demo
repositorypackage
0.0.0-20240817025053-c0dba8cdd283
Repository: https://github.com/lanceplarsen/go-vault-demo.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

go-vault-demo

Go example for hybrid auth, dynamic secrets, and encryption with HashiCorp Vault. This project handles tokens and secrets in-memory, and is API driven. If you're looking for a templated approach, check out Vault Agent

Demo Instruction

This repository provides example deployments on various platforms:

Setup

You can run the sample as a standalone Go application. You will need a Vault instance and a Postgres instance to get started. If you need a Postgres instance you can look at the postgres examples for managed deployments.

  1. Run the Postgres script at your Postgres instance.
  2. Run the Vault script at your Vault instance.
  3. Update the config.toml file for your environment.
  4. Run the Go application.
  5. Try the API.

API

  • Get Orders
$ curl -s -X GET \
   http://localhost:3000/api/orders | jq
[
  {
    "id": 204,
    "customerName": "Lance",
    "productName": "Vault-Ent",
    "orderDate": 1523656082215
  }
]
  • Create Order
$ curl -s -X POST \
   http://localhost:3000/api/orders \
   -H 'content-type: application/json' \
   -d '{"customerName": "Lance", "productName": "Vault-Ent"}' | jq
{
  "id": 204,
  "customerName": "Lance",
  "productName": "Vault-Ent",
  "orderDate": 1523656082215
}
  • Delete Orders
$ curl -s -X DELETE -w "%{http_code}" http://localhost:3000/api/orders | jq
200