posh-providers/usebruno/bruno
2025-09-22 10:25:50 +02:00
..
command.go feat(usebruno/bruno): add provider 2024-12-06 08:48:46 +01:00
config_test.go feat: use json required 2025-09-22 07:05:37 +02:00
config.base.json feat: generate schema 2025-09-19 16:29:28 +02:00
config.go feat: go 1.24.0 2025-02-19 12:09:30 +01:00
config.schema.json feat: update schema 2025-09-22 10:25:50 +02:00
preferences.go feat: go 1.24.0 2025-02-19 12:09:30 +01:00
README.md feat(usebruno/bruno): add provider 2024-12-06 08:48:46 +01:00

POSH Bruno provider

Usage

Plugin

package main

import (
  "github.com/foomo/posh-providers/onepassword"
  "github.com/foomo/posh-providers/usebruno/bruno"
  "github.com/foomo/posh/pkg/cache"
  "github.com/foomo/posh/pkg/command"
)

type Plugin struct {
  l     log.Logger
  cache cache.Cache
  op    *onepassword.OnePassword
}

func New(l log.Logger) (plugin.Plugin, error) {
  var err error
  inst := &Plugin{
    l:        l,
    cache:    cache.MemoryCache{},
    commands: command.Commands{},
  }

  // ...

  inst.op, err = onepassword.New(l, inst.cache)
  if err != nil {
    return nil, errors.Wrap(err, "failed to create onepassword")
  }

  // ...

  inst.commands.Add(bruno.NewCommand(l, bruno.CommandWithOnePassword(inst.op)))

  // ...

  return inst, nil
}

Config

## Bruno
bruno:
  path: '${PROJECT_ROOT}/.posh/bruno'

OnePassword

To inject secrets from 1Password, create a bruno.env file:

JWT_TOKEN=*********************

Render the file to .env:

> bruno env

And use the secret in your environment environments/local.bru:

vars {
  host: http://localhost:5005
  jwtToken: {{process.env.JWT_TOKEN}}
}