package strvals
import "github.com/open-policy-agent/opa/internal/strvals"
Package strvals provides tools for working with strval lines.
OPA runtime config supports a compressed format for YAML settings which we call strvals. The format is roughly like this:
name=value,topname.subname=value
The above is equivalent to the YAML document
name: value topname: subname: value
This package provides a parser and utilities for converting the strvals format to other formats.
Index ¶
- Constants
- Variables
- func Parse(s string) (map[string]interface{}, error)
- func ParseInto(s string, dest map[string]interface{}) error
- func ParseIntoFile(s string, dest map[string]interface{}, runesToVal runesToVal) error
- func ParseIntoString(s string, dest map[string]interface{}) error
- func ParseString(s string) (map[string]interface{}, error)
- func ToYAML(s string) (string, error)
Constants ¶
const MaxIndex = 65536
MaxIndex is the maximum index that will be allowed by setIndex. The default value 65536 = 1024 * 64
Variables ¶
ErrNotList indicates that a non-list was treated as a list.
Functions ¶
func Parse ¶
Parse parses a set line.
A set line is of the form name1=value1,name2=value2
func ParseInto ¶
ParseInto parses a strvals line and merges the result into dest.
If the strval string has a key that exists in dest, it overwrites the dest version.
func ParseIntoFile ¶
ParseIntoFile parses a filevals line and merges the result into dest.
This method always returns a string as the value.
func ParseIntoString ¶
ParseIntoString parses a strvals line and merges the result into dest.
This method always returns a string as the value.
func ParseString ¶
ParseString parses a set line and forces a string value.
A set line is of the form name1=value1,name2=value2
func ToYAML ¶
ToYAML takes a string of arguments and converts to a YAML document.
Source Files ¶
- Version
- v1.4.2 (latest)
- Published
- May 2, 2025
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 6 hours ago –
Tools for package owners.