<!-- Code generated by gomarkdoc. DO NOT EDIT -->

# preprocess

```go
import "github.com/HexmosTech/lama2/preprocess"
```

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

## Index

- [func ExpandEnv\(s string, vm interface\{\}\) string](<#ExpandEnv>)
- [func ExpandHeaders\(block \*gabs.Container, vm interface\{\}\)](<#ExpandHeaders>)
- [func ExpandJSON\(block \*gabs.Container, vm interface\{\}\)](<#ExpandJSON>)
- [func ExpandURL\(block \*gabs.Container, vm interface\{\}\)](<#ExpandURL>)
- [func GetL2EnvVariables\(dir string\) \(map\[string\]map\[string\]interface\{\}, error\)](<#GetL2EnvVariables>)
- [func GetLamaFileAsString\(path string\) \(string, error\)](<#GetLamaFileAsString>)
- [func LamaFile\(inputFile string\) \(string, string\)](<#LamaFile>)
- [func LoadEnvFile\(l2path string\)](<#LoadEnvFile>)
- [func LoadEnvironments\(dir string\)](<#LoadEnvironments>)
- [func ProcessVarsInBlock\(block \*gabs.Container, vm interface\{\}\)](<#ProcessVarsInBlock>)
- [func SearchL2ConfigEnv\(dir string\) \(string, error\)](<#SearchL2ConfigEnv>)


<a name="ExpandEnv"></a>
## func [ExpandEnv](<https://github.com/HexmosTech/Lama2/blob/main/preprocess/expandvar.go#L59>)

```go
func ExpandEnv(s string, vm interface{}) 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.

<a name="ExpandHeaders"></a>
## func [ExpandHeaders](<https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L174>)

```go
func ExpandHeaders(block *gabs.Container, vm interface{})
```



<a name="ExpandJSON"></a>
## func [ExpandJSON](<https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L202>)

```go
func ExpandJSON(block *gabs.Container, vm interface{})
```



<a name="ExpandURL"></a>
## func [ExpandURL](<https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L194>)

```go
func ExpandURL(block *gabs.Container, vm interface{})
```



<a name="GetL2EnvVariables"></a>
## func [GetL2EnvVariables](<https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L113>)

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



<a name="GetLamaFileAsString"></a>
## func [GetLamaFileAsString](<https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L140>)

```go
func GetLamaFileAsString(path string) (string, error)
```



<a name="LamaFile"></a>
## func [LamaFile](<https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L155>)

```go
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.

<a name="LoadEnvFile"></a>
## func [LoadEnvFile](<https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L59>)

```go
func LoadEnvFile(l2path string)
```



<a name="LoadEnvironments"></a>
## func [LoadEnvironments](<https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L67>)

```go
func LoadEnvironments(dir string)
```



<a name="ProcessVarsInBlock"></a>
## func [ProcessVarsInBlock](<https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L168>)

```go
func ProcessVarsInBlock(block *gabs.Container, vm interface{})
```



<a name="SearchL2ConfigEnv"></a>
## func [SearchL2ConfigEnv](<https://github.com/HexmosTech/Lama2/blob/main/preprocess/preprocess.go#L46>)

```go
func SearchL2ConfigEnv(dir string) (string, error)
```



Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)
