Help us shape the future of Go! Take the 2026 Go Developer Survey

opwrap

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2021 License: MIT Imports: 6 Imported by: 0

README

opwrap

The opwrap module can be used to return an op.Op object while leveraging stash if it has been configured.

Installation

To install the module, simply run:

$ go get github.com/walkert/opwrap

Usage

The primary function of opwrap is to return an op.Op object that has been configured with the op.WithPassword option using a password read using the stash client. If stash hasn't been configured or cannot be contacted, a standard op.Op object will be returned.

Leveraging stash

If you have a stash server running, you can configure opwrap to use it by setting the following environment variables:

OPWRAP_CERT - The location of your stash cert file
OPWRAP_CERT - The location of your stash config file
OPWRAP_PORT - The port number your stash server is listening on

Below is a simple example:

package main

import (
    "fmt"
    "log"

    "github.com/walkert/opwrap"
)

func main() {
    o, err := opwrap.GetOP()
    if err != nil {
        log.Fatal(err)
    }
    user, pass, err := o.GetUserPassword("vault item")
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(user, pass)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOP

func GetOP(opts ...op.Opt) (*op.Op, error)

GetOP returns a pointer to an op.Op object configured with a password (if possible)

Types

This section is empty.

Jump to

Keyboard shortcuts

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