preprocess

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package preprocess provides facilities to expand environment variables in `.l2` API files and return the contents

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expand added in v1.3.0

func Expand(s string, vm *goja.Runtime, mapping map[string]string) string

Expand replaces ${var} or $var in the string based on the mapping function. For example, os.ExpandEnv(s) is equivalent to os.Expand(s, os.Getenv).

func ExpandEnv added in v1.3.0

func ExpandEnv(s string, vm *goja.Runtime) string

ExpandEnv replaces ${var} or $var in the string according to the values of the current environment variables. References to undefined variables are replaced by the empty string.

func ExpandHeaders added in v1.3.0

func ExpandHeaders(block *gabs.Container, vm *goja.Runtime)

func ExpandJSON added in v1.3.0

func ExpandJSON(block *gabs.Container, vm *goja.Runtime)

func ExpandURL added in v1.3.0

func ExpandURL(block *gabs.Container, vm *goja.Runtime)

func GetL2EnvVariables added in v1.5.0

func GetL2EnvVariables(dir string) (map[string]map[string]interface{}, error)

func GetLamaFileAsString added in v1.3.0

func GetLamaFileAsString(path string) string

func LamaFile added in v1.1.0

func LamaFile(inputFile string) (string, string)

LamaFile takes in a path to an API file. It moves into the API file directory, reads the API contents, loads the `l2.env` file if available, and finally substitutes environment vars in the API contents Once done, it reverts back to the original directory, and returns the processed l2 file.

func LoadEnvFile added in v1.5.0

func LoadEnvFile(l2path string)

func LoadEnvironments added in v1.5.0

func LoadEnvironments(dir string)

func ProcessVarsInBlock added in v1.3.0

func ProcessVarsInBlock(block *gabs.Container, vm *goja.Runtime)

func SearchL2ConfigEnv added in v1.5.0

func SearchL2ConfigEnv(dir string) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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