Skip to content

Commit 8511216

Browse files
committed
alpha: add support for OUTBLOCKS_VALUE_*
1 parent bc09dcc commit 8511216

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.github/workflows/pr.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ on:
33
push:
44
branches:
55
- master
6-
tags-ignore:
7-
- v*
86
pull_request:
97

108
jobs:

pkg/config/vars.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package config
33
import (
44
"encoding/json"
55
"fmt"
6+
"os"
67
"reflect"
78
"strings"
89

@@ -53,6 +54,17 @@ func expandYAMLString(n *ast.StringNode, file string, vars map[string]interface{
5354

5455
return json.Marshal(val)
5556
}).
57+
WithKeyGetter(func(c *plugin_util.VarContext, vars map[string]interface{}) (val interface{}, err error) {
58+
if strings.HasPrefix(c.Token, "var.") {
59+
env := fmt.Sprintf("OUTBLOCKS_VALUE_%s", c.Token[4:])
60+
val, ok := os.LookupEnv(env)
61+
if ok {
62+
return val, nil
63+
}
64+
}
65+
66+
return plugin_util.DefaultVarKeyGetter(c, vars)
67+
}).
5668
WithSkipRowColumnInfo(true).
5769
WithVarChar('$').ExpandRaw([]byte(n.Value))
5870
if err != nil {

0 commit comments

Comments
 (0)