Skip to content

Commit

Permalink
fix: replace regular liquid template with polly liquid template (#532)
Browse files Browse the repository at this point in the history
* replace regular liquid template with polly liquid template

* fix lint
  • Loading branch information
floreks authored and michaeljguarino committed Aug 28, 2024
1 parent c5daf9a commit 10211e8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
7 changes: 4 additions & 3 deletions cmd/pluralctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import (
"github.com/pluralsh/plural-cli/cmd/command/cd"

"github.com/fatih/color"
"github.com/urfave/cli"
"helm.sh/helm/v3/pkg/action"

"github.com/pluralsh/plural-cli/cmd/command/clone"
cryptocmd "github.com/pluralsh/plural-cli/cmd/command/crypto"
"github.com/pluralsh/plural-cli/cmd/command/down"
Expand All @@ -20,8 +23,6 @@ import (
conf "github.com/pluralsh/plural-cli/pkg/config"
"github.com/pluralsh/plural-cli/pkg/crypto"
"github.com/pluralsh/plural-cli/pkg/utils"
"github.com/urfave/cli"
"helm.sh/helm/v3/pkg/action"
)

const ApplicationName = "pluralctl"
Expand Down Expand Up @@ -69,7 +70,7 @@ func main() {
cd.Command(plural.Plural, plural.HelmConfiguration),
up.Command(plural.Plural),
down.Command(),
pr.Command(),
pr.Command(plural.Plural),
cmdinit.Command(plural.Plural),
mgmt.Command(plural.Plural),
profile.Command(),
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ require (
github.com/mitchellh/mapstructure v1.5.0
github.com/norwoodj/helm-docs v1.11.2
github.com/olekukonko/tablewriter v0.0.5
github.com/osteele/liquid v1.4.0
github.com/packethost/packngo v0.29.0
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
github.com/pluralsh/cluster-api-migration v0.2.16
Expand Down Expand Up @@ -227,6 +226,7 @@ require (
github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 // indirect
github.com/onsi/gomega v1.32.0 // indirect
github.com/orcaman/concurrent-map v1.0.0 // indirect
github.com/osteele/liquid v1.4.0 // indirect
github.com/osteele/tuesday v1.0.3 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
Expand Down
9 changes: 3 additions & 6 deletions pkg/cd/control_plane_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import (
"gopkg.in/yaml.v3"

"github.com/AlecAivazis/survey/v2"
"github.com/osteele/liquid"
pollytemplate "github.com/pluralsh/polly/template"

"github.com/pluralsh/plural-cli/pkg/api"
"github.com/pluralsh/plural-cli/pkg/bundle"
"github.com/pluralsh/plural-cli/pkg/config"
Expand All @@ -22,10 +23,6 @@ import (
"github.com/pluralsh/plural-cli/pkg/utils/git"
)

var (
liquidEngine = liquid.NewEngine()
)

const (
templateUrl = "https://raw.githubusercontent.com/pluralsh/console/master/templates/values.yaml.liquid"
tplUrl = "https://raw.githubusercontent.com/pluralsh/console/master/templates/values.yaml.tpl"
Expand Down Expand Up @@ -241,7 +238,7 @@ func CreateControlPlane(conf config.Config) (string, error) {
"configuration": configuration,
}

res, err := liquidEngine.ParseAndRender(tpl, bindings)
res, err := pollytemplate.RenderLiquid(tpl, bindings)
return string(res), err
}

Expand Down
8 changes: 2 additions & 6 deletions pkg/pr/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@ import (
"os"
"path/filepath"

"github.com/osteele/liquid"
)

var (
liquidEngine = liquid.NewEngine()
"github.com/pluralsh/polly/template"
)

func templateReplacement(data []byte, ctx map[string]interface{}) ([]byte, error) {
bindings := map[string]interface{}{
"context": ctx,
}
return liquidEngine.ParseAndRender(data, bindings)
return template.RenderLiquid(data, bindings)
}

func replaceTo(from, to string, rep func(data []byte) ([]byte, error)) error {
Expand Down

0 comments on commit 10211e8

Please sign in to comment.