feat(env): add template properties

This commit is contained in:
Jan De Dobbeleer 2021-11-14 10:50:47 +01:00 committed by Jan De Dobbeleer
parent c1bc4404e0
commit 2040771190
3 changed files with 13 additions and 6 deletions

View file

@ -50,3 +50,7 @@ The segment will show when the value of the environment variable isn't empty.
```
- var_name: `string` - the name of the environment variable
## Template Properties
- `.Value`: `string` - the value of the environment variable

View file

@ -1,9 +1,9 @@
package main
type envvar struct {
props *properties
env environmentInfo
content string
props *properties
env environmentInfo
Value string
}
const (
@ -13,12 +13,12 @@ const (
func (e *envvar) enabled() bool {
name := e.props.getString(VarName, "")
e.content = e.env.getenv(name)
return e.content != ""
e.Value = e.env.getenv(name)
return e.Value != ""
}
func (e *envvar) string() string {
return e.content
return e.Value
}
func (e *envvar) init(props *properties, env environmentInfo) {

View file

@ -447,6 +447,9 @@
"properties": {
"properties": {
"properties": {
"template": {
"$ref": "#/definitions/template"
},
"var_name": {
"type": "string",
"title": "Variable Name",