opa: github.com/open-policy-agent/opa/internal/strvals Index | Files

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

Package Files

doc.go parser.go

Variables

var ErrNotList = errors.New("not a list")

ErrNotList indicates that a non-list was treated as a list.

func Parse Uses

func Parse(s string) (map[string]interface{}, error)

Parse parses a set line.

A set line is of the form name1=value1,name2=value2

func ParseFile Uses

func ParseFile(s string, runesToVal runesToVal) (map[string]interface{}, error)

ParseFile parses a set line, but its final value is loaded from the file at the path specified by the original value.

A set line is of the form name1=path1,name2=path2

When the files at path1 and path2 contained "val1" and "val2" respectively, the set line is consumed as name1=val1,name2=val2

func ParseInto Uses

func ParseInto(s string, dest map[string]interface{}) error

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 Uses

func ParseIntoFile(s string, dest map[string]interface{}, runesToVal runesToVal) error

ParseIntoFile parses a filevals line and merges the result into dest.

This method always returns a string as the value.

func ParseIntoString Uses

func ParseIntoString(s string, dest map[string]interface{}) error

ParseIntoString parses a strvals line and merges the result into dest.

This method always returns a string as the value.

func ParseString Uses

func ParseString(s string) (map[string]interface{}, error)

ParseString parses a set line and forces a string value.

A set line is of the form name1=value1,name2=value2

func ToYAML Uses

func ToYAML(s string) (string, error)

ToYAML takes a string of arguments and converts to a YAML document.

Package strvals imports 7 packages (graph) and is imported by 2 packages. Updated 2019-04-11. Refresh now. Tools for package owners.