tomlpath

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 7 Imported by: 0

README

TOMLPath Extractor Modifier (tp)

This plugin provides a TOML JSONPath modifier for spelunk. It allows you to extract specific values from TOML secrets using JSONPath syntax.

Usage

package main

import (
	"context"
	"fmt"

	"github.com/detro/spelunk"
	"github.com/detro/spelunk/plugin/modifier/tomlpath"
)

func main() {
	s, _ := spelunk.NewSpelunker(tomlpath.WithTOMLPath())
	
	// Assuming `plain://...` contains `[data]\nfoo = "bar"`
	res, _ := s.DigUp(context.Background(), "plain://.../?tp=$.data.foo")
	
	fmt.Println(res) // Outputs: bar
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTOMLPathInvalid        = fmt.Errorf("invalid TOML JSONPath expression")
	ErrTOMLPathFailed         = fmt.Errorf("failed to apply TOML JSONPath")
	ErrTOMLPathMatchingFailed = fmt.Errorf("failed to match TOML JSONPath")
	ErrSecretNotTOML          = fmt.Errorf("secret is not a valid TOML")
)

Functions

func WithTOMLPath

func WithTOMLPath() spelunk.SpelunkerOption

WithTOMLPath adds the TOML JSONPath modifier to a Spelunker.

Types

type SecretModifierTOMLPath

type SecretModifierTOMLPath struct{}

SecretModifierTOMLPath is a modifier that can extract a specific field out of a TOML stored in a secret value. It parses the TOML into an object and applies standard JSONPath to it.

func (*SecretModifierTOMLPath) Modify

func (s *SecretModifierTOMLPath) Modify(
	_ context.Context,
	secretValue string,
	mod string,
) (string, error)

func (*SecretModifierTOMLPath) Type

func (s *SecretModifierTOMLPath) Type() string

Jump to

Keyboard shortcuts

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