demo
This commit is contained in:
commit
1a72fce851
105 changed files with 4844 additions and 0 deletions
64
.history/agent-config_20241107145131.hcl
Normal file
64
.history/agent-config_20241107145131.hcl
Normal file
|
@ -0,0 +1,64 @@
|
|||
pid_file = "./pidfile"
|
||||
|
||||
vault {
|
||||
address = "https://openbao-fqdn:8200"
|
||||
retry {
|
||||
num_retries = 5
|
||||
}
|
||||
}
|
||||
|
||||
auto_auth {
|
||||
method "kubernetes" {
|
||||
config = {
|
||||
role = "foobar"
|
||||
}
|
||||
}
|
||||
|
||||
sink "file" {
|
||||
config = {
|
||||
path = "/tmp/file-foo"
|
||||
}
|
||||
}
|
||||
|
||||
sink "file" {
|
||||
wrap_ttl = "5m"
|
||||
aad_env_var = "TEST_AAD_ENV"
|
||||
dh_type = "curve25519"
|
||||
dh_path = "/tmp/file-foo-dhpath2"
|
||||
config = {
|
||||
path = "/tmp/file-bar"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cache {
|
||||
// An empty cache stanza still enables caching
|
||||
}
|
||||
|
||||
api_proxy {
|
||||
use_auto_auth_token = true
|
||||
}
|
||||
|
||||
listener "unix" {
|
||||
address = "/path/to/socket"
|
||||
tls_disable = true
|
||||
|
||||
agent_api {
|
||||
enable_quit = true
|
||||
}
|
||||
}
|
||||
|
||||
listener "tcp" {
|
||||
address = "127.0.0.1:8100"
|
||||
tls_disable = true
|
||||
}
|
||||
|
||||
template {
|
||||
source = "/etc/openbao/server.key.ctmpl"
|
||||
destination = "/etc/openbao/server.key"
|
||||
}
|
||||
|
||||
template {
|
||||
source = "/etc/openbao/server.crt.ctmpl"
|
||||
destination = "/etc/openbao/server.crt"
|
||||
}
|
64
.history/agent-config_20241107145904.hcl
Normal file
64
.history/agent-config_20241107145904.hcl
Normal file
|
@ -0,0 +1,64 @@
|
|||
pid_file = "./pidfile"
|
||||
|
||||
vault {
|
||||
address = "https://localhost:8200"
|
||||
retry {
|
||||
num_retries = 5
|
||||
}
|
||||
}
|
||||
|
||||
auto_auth {
|
||||
method "kubernetes" {
|
||||
config = {
|
||||
role = "foobar"
|
||||
}
|
||||
}
|
||||
|
||||
sink "file" {
|
||||
config = {
|
||||
path = "/tmp/file-foo"
|
||||
}
|
||||
}
|
||||
|
||||
sink "file" {
|
||||
wrap_ttl = "5m"
|
||||
aad_env_var = "TEST_AAD_ENV"
|
||||
dh_type = "curve25519"
|
||||
dh_path = "/tmp/file-foo-dhpath2"
|
||||
config = {
|
||||
path = "/tmp/file-bar"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cache {
|
||||
// An empty cache stanza still enables caching
|
||||
}
|
||||
|
||||
api_proxy {
|
||||
use_auto_auth_token = true
|
||||
}
|
||||
|
||||
listener "unix" {
|
||||
address = "/path/to/socket"
|
||||
tls_disable = true
|
||||
|
||||
agent_api {
|
||||
enable_quit = true
|
||||
}
|
||||
}
|
||||
|
||||
listener "tcp" {
|
||||
address = "127.0.0.1:8100"
|
||||
tls_disable = true
|
||||
}
|
||||
|
||||
template {
|
||||
source = "/etc/openbao/server.key.ctmpl"
|
||||
destination = "/etc/openbao/server.key"
|
||||
}
|
||||
|
||||
template {
|
||||
source = "/etc/openbao/server.crt.ctmpl"
|
||||
destination = "/etc/openbao/server.crt"
|
||||
}
|
64
.history/agent-config_20241107145928.hcl
Normal file
64
.history/agent-config_20241107145928.hcl
Normal file
|
@ -0,0 +1,64 @@
|
|||
pid_file = "./pidfile"
|
||||
|
||||
vault {
|
||||
address = "https://openbao-fqdn:8200"
|
||||
retry {
|
||||
num_retries = 5
|
||||
}
|
||||
}
|
||||
|
||||
auto_auth {
|
||||
method "kubernetes" {
|
||||
config = {
|
||||
role = "foobar"
|
||||
}
|
||||
}
|
||||
|
||||
sink "file" {
|
||||
config = {
|
||||
path = "/tmp/file-foo"
|
||||
}
|
||||
}
|
||||
|
||||
sink "file" {
|
||||
wrap_ttl = "5m"
|
||||
aad_env_var = "TEST_AAD_ENV"
|
||||
dh_type = "curve25519"
|
||||
dh_path = "/tmp/file-foo-dhpath2"
|
||||
config = {
|
||||
path = "/tmp/file-bar"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cache {
|
||||
// An empty cache stanza still enables caching
|
||||
}
|
||||
|
||||
api_proxy {
|
||||
use_auto_auth_token = true
|
||||
}
|
||||
|
||||
listener "unix" {
|
||||
address = "/path/to/socket"
|
||||
tls_disable = true
|
||||
|
||||
agent_api {
|
||||
enable_quit = true
|
||||
}
|
||||
}
|
||||
|
||||
listener "tcp" {
|
||||
address = "127.0.0.1:8100"
|
||||
tls_disable = true
|
||||
}
|
||||
|
||||
template {
|
||||
source = "/etc/openbao/server.key.ctmpl"
|
||||
destination = "/etc/openbao/server.key"
|
||||
}
|
||||
|
||||
template {
|
||||
source = "/etc/openbao/server.crt.ctmpl"
|
||||
destination = "/etc/openbao/server.crt"
|
||||
}
|
0
.history/main_20241107142952.go
Normal file
0
.history/main_20241107142952.go
Normal file
1
.history/main_20241107143236.go
Normal file
1
.history/main_20241107143236.go
Normal file
|
@ -0,0 +1 @@
|
|||
pac
|
1
.history/main_20241107143239.go
Normal file
1
.history/main_20241107143239.go
Normal file
|
@ -0,0 +1 @@
|
|||
package main
|
3
.history/main_20241107143242.go
Normal file
3
.history/main_20241107143242.go
Normal file
|
@ -0,0 +1,3 @@
|
|||
package main
|
||||
|
||||
main
|
3
.history/main_20241107143247.go
Normal file
3
.history/main_20241107143247.go
Normal file
|
@ -0,0 +1,3 @@
|
|||
package main
|
||||
|
||||
func main
|
3
.history/main_20241107143249.go
Normal file
3
.history/main_20241107143249.go
Normal file
|
@ -0,0 +1,3 @@
|
|||
package main
|
||||
|
||||
func main()
|
5
.history/main_20241107143252.go
Normal file
5
.history/main_20241107143252.go
Normal file
|
@ -0,0 +1,5 @@
|
|||
package main
|
||||
|
||||
func main(){
|
||||
|
||||
}
|
7
.history/main_20241107143257.go
Normal file
7
.history/main_20241107143257.go
Normal file
|
@ -0,0 +1,7 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main(){
|
||||
fmt.Printl
|
||||
}
|
7
.history/main_20241107143258.go
Normal file
7
.history/main_20241107143258.go
Normal file
|
@ -0,0 +1,7 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main(){
|
||||
fmt.Println()
|
||||
}
|
7
.history/main_20241107143300.go
Normal file
7
.history/main_20241107143300.go
Normal file
|
@ -0,0 +1,7 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main(){
|
||||
fmt.Println("hello")
|
||||
}
|
8
.history/main_20241107143506.go
Normal file
8
.history/main_20241107143506.go
Normal file
|
@ -0,0 +1,8 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
import openbao "github.com/openbao/openbao/api/v2"
|
||||
|
||||
func main(){
|
||||
fmt.Println("hello")
|
||||
}
|
17
.history/main_20241107143528.go
Normal file
17
.history/main_20241107143528.go
Normal file
|
@ -0,0 +1,17 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
import openbao "github.com/openbao/openbao/api/v2"
|
||||
|
||||
func main(){
|
||||
config := openbao.DefaultConfig()
|
||||
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
}
|
21
.history/main_20241107143534.go
Normal file
21
.history/main_20241107143534.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
config := openbao.DefaultConfig()
|
||||
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
}
|
21
.history/main_20241107143540.go
Normal file
21
.history/main_20241107143540.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
config := openbao.DefaultConfig()
|
||||
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
}
|
21
.history/main_20241107143541.go
Normal file
21
.history/main_20241107143541.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
config := openbao.DefaultConfig()
|
||||
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
}
|
21
.history/main_20241107143543.go
Normal file
21
.history/main_20241107143543.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
config := openbao.DefaultConfig()
|
||||
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
}
|
21
.history/main_20241107143546.go
Normal file
21
.history/main_20241107143546.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
config := openbao.DefaultConfig()
|
||||
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
}
|
20
.history/main_20241107143550.go
Normal file
20
.history/main_20241107143550.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
}
|
21
.history/main_20241107143556.go
Normal file
21
.history/main_20241107143556.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
}
|
21
.history/main_20241107143558.go
Normal file
21
.history/main_20241107143558.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.P
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
}
|
21
.history/main_20241107143600.go
Normal file
21
.history/main_20241107143600.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.Println()
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
}
|
21
.history/main_20241107143606.go
Normal file
21
.history/main_20241107143606.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
}
|
25
.history/main_20241107143644.go
Normal file
25
.history/main_20241107143644.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
}
|
||||
|
||||
func writePassword(){
|
||||
|
||||
}
|
35
.history/main_20241107143645.go
Normal file
35
.history/main_20241107143645.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
}
|
||||
|
||||
func writePassword(){
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
}
|
37
.history/main_20241107143705.go
Normal file
37
.history/main_20241107143705.go
Normal file
|
@ -0,0 +1,37 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
}
|
||||
|
||||
func writePassword(){
|
||||
|
||||
}
|
38
.history/main_20241107143710.go
Normal file
38
.history/main_20241107143710.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
}
|
||||
|
||||
func writePassword(){
|
||||
|
||||
}
|
34
.history/main_20241107143716.go
Normal file
34
.history/main_20241107143716.go
Normal file
|
@ -0,0 +1,34 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
}
|
33
.history/main_20241107143739.go
Normal file
33
.history/main_20241107143739.go
Normal file
|
@ -0,0 +1,33 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
}
|
35
.history/main_20241107143812.go
Normal file
35
.history/main_20241107143812.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
}
|
35
.history/main_20241107143814.go
Normal file
35
.history/main_20241107143814.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
//
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
}
|
35
.history/main_20241107143819.go
Normal file
35
.history/main_20241107143819.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
}
|
47
.history/main_20241107143833.go
Normal file
47
.history/main_20241107143833.go
Normal file
|
@ -0,0 +1,47 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
}
|
47
.history/main_20241107143838.go
Normal file
47
.history/main_20241107143838.go
Normal file
|
@ -0,0 +1,47 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
}
|
53
.history/main_20241107143858.go
Normal file
53
.history/main_20241107143858.go
Normal file
|
@ -0,0 +1,53 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
}
|
54
.history/main_20241107144310.go
Normal file
54
.history/main_20241107144310.go
Normal file
|
@ -0,0 +1,54 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.P
|
||||
}
|
54
.history/main_20241107144313.go
Normal file
54
.history/main_20241107144313.go
Normal file
|
@ -0,0 +1,54 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println
|
||||
}
|
54
.history/main_20241107144314.go
Normal file
54
.history/main_20241107144314.go
Normal file
|
@ -0,0 +1,54 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println()
|
||||
}
|
54
.history/main_20241107144321.go
Normal file
54
.history/main_20241107144321.go
Normal file
|
@ -0,0 +1,54 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
54
.history/main_20241107145003.go
Normal file
54
.history/main_20241107145003.go
Normal file
|
@ -0,0 +1,54 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
56
.history/main_20241107145004.go
Normal file
56
.history/main_20241107145004.go
Normal file
|
@ -0,0 +1,56 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
56
.history/main_20241107145006.go
Normal file
56
.history/main_20241107145006.go
Normal file
|
@ -0,0 +1,56 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
58
.history/main_20241107145009.go
Normal file
58
.history/main_20241107145009.go
Normal file
|
@ -0,0 +1,58 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
58
.history/main_20241107145013.go
Normal file
58
.history/main_20241107145013.go
Normal file
|
@ -0,0 +1,58 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Print()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
58
.history/main_20241107145015.go
Normal file
58
.history/main_20241107145015.go
Normal file
|
@ -0,0 +1,58 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
58
.history/main_20241107145018.go
Normal file
58
.history/main_20241107145018.go
Normal file
|
@ -0,0 +1,58 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello there")
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241107151310.go
Normal file
59
.history/main_20241107151310.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello there")
|
||||
main
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241107151311.go
Normal file
59
.history/main_20241107151311.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello there")
|
||||
main#
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241107151314.go
Normal file
59
.history/main_20241107151314.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241126101419.go
Normal file
59
.history/main_20241126101419.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://https://cnoe.localtest.me/openbao:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241126101424.go
Normal file
59
.history/main_20241126101424.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://cnoe.localtest.me/openbao:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241126101430.go
Normal file
59
.history/main_20241126101430.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://cnoe.localtest.me/openbao:8200:"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241126101433.go
Normal file
59
.history/main_20241126101433.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://cnoe.localtest.me/openbao:82"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241126101435.go
Normal file
59
.history/main_20241126101435.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://cnoe.localtest.me/openbao:80"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241126101550.go
Normal file
59
.history/main_20241126101550.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://127.0.0.1:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241126112832.go
Normal file
59
.history/main_20241126112832.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "https://cnoe.localtest.me/openbao"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241126112836.go
Normal file
59
.history/main_20241126112836.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://cnoe.localtest.me/openbao"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241126112845.go
Normal file
59
.history/main_20241126112845.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://cnoe.localtest.me/openbaos"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241126112852.go
Normal file
59
.history/main_20241126112852.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://cnoe.localtest.me/openbao"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241126130838.go
Normal file
59
.history/main_20241126130838.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://localhost/openbao"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241127132020.go
Normal file
59
.history/main_20241127132020.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://openbao.localtest.me/"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241127132022.go
Normal file
59
.history/main_20241127132022.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://openbao.localtest.me"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241127155330.go
Normal file
59
.history/main_20241127155330.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://openbao.localtest.me"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241128130857.go
Normal file
59
.history/main_20241128130857.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://openbao.localtest.me"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241128143954.go
Normal file
59
.history/main_20241128143954.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://localhost:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241128144051.go
Normal file
59
.history/main_20241128144051.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://localhost:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
60
.history/main_20241128144053.go
Normal file
60
.history/main_20241128144053.go
Normal file
|
@ -0,0 +1,60 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://localhost:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
dev-only-token
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
60
.history/main_20241128144058.go
Normal file
60
.history/main_20241128144058.go
Normal file
|
@ -0,0 +1,60 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://localhost:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")dev-only-token
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
60
.history/main_20241128144101.go
Normal file
60
.history/main_20241128144101.go
Normal file
|
@ -0,0 +1,60 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2(){
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://localhost:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
60
.history/main_20241128144104.go
Normal file
60
.history/main_20241128144104.go
Normal file
|
@ -0,0 +1,60 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://localhost:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
60
.history/main_20241128144317.go
Normal file
60
.history/main_20241128144317.go
Normal file
|
@ -0,0 +1,60 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://localhost:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
// client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
60
.history/main_20241128144319.go
Normal file
60
.history/main_20241128144319.go
Normal file
|
@ -0,0 +1,60 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://localhost:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
// client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
60
.history/main_20241128144329.go
Normal file
60
.history/main_20241128144329.go
Normal file
|
@ -0,0 +1,60 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://localhost:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
// client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
60
.history/main_20241128144331.go
Normal file
60
.history/main_20241128144331.go
Normal file
|
@ -0,0 +1,60 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://localhost:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
61
.history/main_20241128144504.go
Normal file
61
.history/main_20241128144504.go
Normal file
|
@ -0,0 +1,61 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://localhost:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
62
.history/main_20241128144509.go
Normal file
62
.history/main_20241128144509.go
Normal file
|
@ -0,0 +1,62 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://localhost:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
client.
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
62
.history/main_20241128144549.go
Normal file
62
.history/main_20241128144549.go
Normal file
|
@ -0,0 +1,62 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://localhost:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
client.KVv2()
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
62
.history/main_20241128145829.go
Normal file
62
.history/main_20241128145829.go
Normal file
|
@ -0,0 +1,62 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://localhost:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
client.
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
62
.history/main_20241128145830.go
Normal file
62
.history/main_20241128145830.go
Normal file
|
@ -0,0 +1,62 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://localhost:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
client.
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
62
.history/main_20241128145833.go
Normal file
62
.history/main_20241128145833.go
Normal file
|
@ -0,0 +1,62 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://localhost:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
client.Address()
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
62
.history/main_20241128145842.go
Normal file
62
.history/main_20241128145842.go
Normal file
|
@ -0,0 +1,62 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://localhost:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
client.
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
62
.history/main_20241128145854.go
Normal file
62
.history/main_20241128145854.go
Normal file
|
@ -0,0 +1,62 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://localhost:8200"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
client.KVv1()
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
62
.history/main_20241202101616.go
Normal file
62
.history/main_20241202101616.go
Normal file
|
@ -0,0 +1,62 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://http://openbao.localtest.me/ui/"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
client.KVv1()
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
62
.history/main_20241202101619.go
Normal file
62
.history/main_20241202101619.go
Normal file
|
@ -0,0 +1,62 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://openbao.localtest.me/ui/"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
client.KVv1()
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
62
.history/main_20241202101621.go
Normal file
62
.history/main_20241202101621.go
Normal file
|
@ -0,0 +1,62 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://openbao.localtest.me"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
client.KVv1()
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
62
.history/main_20241202101624.go
Normal file
62
.history/main_20241202101624.go
Normal file
|
@ -0,0 +1,62 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://openbao.localtest.me"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
client.KVv1()
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
60
.history/main_20241202101636.go
Normal file
60
.history/main_20241202101636.go
Normal file
|
@ -0,0 +1,60 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://openbao.localtest.me"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
59
.history/main_20241202101845.go
Normal file
59
.history/main_20241202101845.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://openbao.localtest.me"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
58
.history/main_20241202101848.go
Normal file
58
.history/main_20241202101848.go
Normal file
|
@ -0,0 +1,58 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://openbao.localtest.me"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
58
.history/main_20241202101911.go
Normal file
58
.history/main_20241202101911.go
Normal file
|
@ -0,0 +1,58 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://openbao.localtest.me"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-tokens")
|
||||
|
||||
// Writing a secret
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
58
.history/main_20241202101916.go
Normal file
58
.history/main_20241202101916.go
Normal file
|
@ -0,0 +1,58 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://openbao.localtest.me"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
58
.history/main_20241202102519.go
Normal file
58
.history/main_20241202102519.go
Normal file
|
@ -0,0 +1,58 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://openbao.localtest.me"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
58
.history/main_20241202102520.go
Normal file
58
.history/main_20241202102520.go
Normal file
|
@ -0,0 +1,58 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://openbao.localtest.me"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
// client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
58
.history/main_20241202102530.go
Normal file
58
.history/main_20241202102530.go
Normal file
|
@ -0,0 +1,58 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://openbao.localtest.me"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
58
.history/main_20241202102531.go
Normal file
58
.history/main_20241202102531.go
Normal file
|
@ -0,0 +1,58 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://openbao.localtest.me"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("dev-only-token")
|
||||
|
||||
// Writing a secret
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
58
.history/main_20241202103035.go
Normal file
58
.history/main_20241202103035.go
Normal file
|
@ -0,0 +1,58 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// fmt.Println("hello there")
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://openbao.localtest.me"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("root")
|
||||
|
||||
// Writing a secret
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
57
.history/main_20241202104241.go
Normal file
57
.history/main_20241202104241.go
Normal file
|
@ -0,0 +1,57 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://openbao.localtest.me"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
// client.SetToken("s.javThgMSxCxyJbpS8sSNOPhO")
|
||||
client.SetToken("root")
|
||||
|
||||
// Writing a secret
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
56
.history/main_20241202104245.go
Normal file
56
.history/main_20241202104245.go
Normal file
|
@ -0,0 +1,56 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
openbao "github.com/openbao/openbao/api/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
main2()
|
||||
}
|
||||
|
||||
func main2() {
|
||||
fmt.Println("Connecting...")
|
||||
config := openbao.DefaultConfig()
|
||||
config.Address = "http://openbao.localtest.me"
|
||||
|
||||
client, err := openbao.NewClient(config)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to initialize OpenBao client: %v", err)
|
||||
}
|
||||
|
||||
client.SetToken("root")
|
||||
|
||||
// Writing a secret
|
||||
secretData := map[string]interface{}{
|
||||
"password": "OpenBao123",
|
||||
}
|
||||
|
||||
_, err = client.KVv2("secret").Put(context.Background(), "my-secret-password", secretData)
|
||||
if err != nil {
|
||||
log.Fatalf("unable to write secret: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Secret written successfully.")
|
||||
|
||||
// Retrieving a secret
|
||||
secret, err := client.KVv2("secret").Get(context.Background(), "my-secret-password")
|
||||
if err != nil {
|
||||
log.Fatalf("unable to read secret: %v", err)
|
||||
}
|
||||
|
||||
value, ok := secret.Data["password"].(string)
|
||||
if !ok {
|
||||
log.Fatalf("value type assertion failed: %T %#v", secret.Data["password"], secret.Data["password"])
|
||||
}
|
||||
|
||||
if value != "OpenBao123" {
|
||||
log.Fatalf("unexpected password value %q retrieved from openbao", value)
|
||||
}
|
||||
|
||||
fmt.Println("Access granted!")
|
||||
fmt.Println(value)
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue