subchen / frep Goto Github PK
View Code? Open in Web Editor NEWGenerate file using template from environment, arguments, json/yaml/toml config files
License: Apache License 2.0
Generate file using template from environment, arguments, json/yaml/toml config files
License: Apache License 2.0
The build is generating Intel binaries
[user3@p006vm77 frep]$ make build
rm -rf frep ./_releases ./_build
go fmt ./...
CGO_ENABLED=0 GOOS=linux GOARCH=amd64
go build -a -installsuffix cgo -ldflags "-s -w -X 'main.BuildVersion=1.3.11' -X 'main.BuildGitBranch=heads/master' -X 'main.BuildGitRev=166' -X 'main.BuildGitCommit=e325a0c21a6db33f763aa8e1f7ea7bd65402661a' -X 'main.BuildDate=Tue, 08 Sep 2020 13:06:33 +0000'" -o _releases/frep-1.3.11-linux-amd64
[user3@p006vm77 frep]$ find . -name frep-1.3.11-linux-amd64
./_releases/frep-1.3.11-linux-amd64
[user3@p006vm77 frep]$ file ./_releases/frep-1.3.11-linux-amd64
./_releases/frep-1.3.11-linux-amd64: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
Would it be possible to write a template file like this?
something = {{ Env.FOO, "bar" }}
which will populate the placeholder with bar
if the env variable FOO
does not exist
Under a alpine:latest image, the released amd64 binary fails with:
/ # /foo/docker-images/helpers/add_frep.sh # downloads & put the binary in $PATH
frep-1.3.4-linux-amd64: OK
'frep-1.3.4-linux-amd64' -> '/usr/bin/frep'
/ # frep --version
sh: frep: not found
Same glue against an ubuntu image just works.
Rebuilding the binary with latest golang:alpine image make the bin works under alpine, but then not on ubuntu (so glibc based).
Please exclude support for environment variables in the templates (the .Env.*
insertions according to the documentation). This can expose a lot of unintentional information (just run set
in your shell to see what is available).
Preferred behaviour:
--no-sys-env
to true
(or rename option).--env
, --json
or --load
.Simple work around is to add --no-sys-env
parameter.
File perms (specifically +x ) are lost when a template file is run though frep. Please preserve originating file permissions when writing out the rendered template.
比如
环境变量:
{
host_ip": {
"127.0.0.1:8081",
"127.0.0.1:8082"
}
}
配置文件中的配置项:
host={{range .host_ip}}{{.}},{{end}}
用frep替换之后的结果是:
host=127.0.0.1:8081,127.0.0.1:8082,
怎么去掉最后8082后面的,呢
Would be great to see this packaged into Debian
Update install script to install into /usr/local/bin
instead of /usr/bin
Hi there,
I want to access .ENV.Secret
inside the range. How do I do that?
{{- range (splitList "," .Env.XMPP_JVBS) }}
Component "{{.}}"
component_secret "{{.ENV.Secret}}"
{{- end }}
Thanks!
Error on installing frep using homebrew.
System setup: macOS Monterey Version 12.4
% brew install subchen/tap/frep
==> Tapping subchen/tap
Cloning into '/usr/local/Homebrew/Library/Taps/subchen/homebrew-tap'...
remote: Enumerating objects: 180, done.
remote: Counting objects: 100% (32/32), done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 180 (delta 14), reused 19 (delta 7), pack-reused 148
Receiving objects: 100% (180/180), 32.90 KiB | 1.37 MiB/s, done.
Resolving deltas: 100% (65/65), done.
Error: Invalid formula: /usr/local/Homebrew/Library/Taps/subchen/homebrew-tap/Formula/gometalinter.rb
gometalinter: wrong number of arguments (given 1, expected 0)
Error: Cannot tap subchen/tap: invalid syntax in tap!
arm aarch64 架构软件支持,期待能编译运行。
version info: frep-1.3.10-linux-amd64
According to git.mod, frep now uses 'Masterminds/sprig' of V2.22.
github.com/Masterminds/sprig v2.22.0+incompatible
I hope to have a 'get' dict function which is available from V3 of 'Masterminds/sprig'.
I always use frep with '--missing error'.
With 'get', I can say somthing like
{{ if eq (get . "optional_value") "ON" }}
instead of
{{ if hasKey . "optional_value" }} {{ if eq .optional_value "ON" }}
frep nginx.conf.in --load config.toml
fatal: bad toml format, caused:
Near line 1 (last key parsed 'webroot'): expected value but found '/' instead
Hello,
in the meantime thank you very much for the great tool.
Our container security scanning tool (Trivy) shows few security issues caused by the frep tool.
Could you update the package below?
Thank you very much in advance
Francesco
Vulnerability: | CVE-2020-29652 |
---|---|
Severity: | High |
nvd: | 7.5 |
redhat: | 7.5 |
Package: | golang.org/x/crypto |
Current Version: | v0.0.0-20190308221718-c2843e01d9a2 |
Fixed in Version: | 0.0.0-20201216223049-8b5274cf687f |
Vulnerability: | CVE-2020-7919 |
Severity: | High |
nvd: | 7.5 |
redhat: | 7.5 |
Package: | golang.org/x/crypto |
Current Version: | v0.0.0-20190308221718-c2843e01d9a2 |
Fixed in Version: | 0.0.0-20200124225646-8b5121be2f68 |
Vulnerability: | CVE-2020-9283 |
Severity: | High |
nvd: | 7.5 |
redhat: | 7.5 |
Package: | golang.org/x/crypto |
Current Version: | v0.0.0-20190308221718-c2843e01d9a2 |
Fixed in Version: | 0.0.0-20200220183623-bac4c82f6975 |
Vulnerability: | CVE-2021-43565 |
Severity: | High |
nvd: | 7.5 |
redhat: | 7.5 |
Package: | golang.org/x/crypto |
Current Version: | v0.0.0-20190308221718-c2843e01d9a2 |
Fixed in Version: | 0.0.0-20211202192323-5770296d904e |
Vulnerability: | CVE-2022-27191 |
Severity: | High |
nvd: | 7.5 |
redhat: | 7.5 |
Package: | golang.org/x/crypto |
Current Version: | v0.0.0-20190308221718-c2843e01d9a2 |
Fixed in Version: | 0.0.0-20220314234659-1baeb1ce4c0b |
Vulnerability: | CVE-2020-8911 |
Severity: | Medium |
nvd: | 5.6 |
redhat: | 5.6 |
Package: | github.com/aws/aws-sdk-go |
Current Version: | v1.30.29 |
Fixed in Version: | |
Vulnerability: | CVE-2019-11254 |
Severity: | Medium |
nvd: | 6.5 |
redhat: | 6.5 |
Package: | github.com/go-yaml/yaml |
Current Version: | v2.1.0+incompatible |
Fixed in Version: | |
Vulnerability: | CVE-2019-11840 |
Severity: | Medium |
nvd: | 5.9 |
redhat: | 5.9 |
Package: | golang.org/x/crypto |
Current Version: | v0.0.0-20190308221718-c2843e01d9a2 |
Fixed in Version: | 0.0.0-20190320223903-b7391e95e576 |
Vulnerability: | CVE-2021-4235 |
Severity: | |
nvd: | |
redhat: | github.com/go-yaml/yaml |
Package: | |
Current Version: | v2.1.0+incompatibleNo |
Fixed in Version: | |
Vulnerability: | CVE-2022-2582 |
Severity: | |
nvd: | |
redhat: | |
Package: | github.com/aws/aws-sdk-go |
Current Version: | v1.30.29 |
Fixed in Version: | |
Vulnerability: | CVE-2020-8912 |
Severity: | Low |
nvd: | 2.5 |
redhat: | 2.5 |
Package: | github.com/aws/aws-sdk-go |
Current Version: | v1.30.29 |
Fixed in Version: |
Vulnerability: CVE-2020-29652
Severity: High
nvd: 7.5
redhat: 7.5
Package: golang.org/x/crypto
Current Version: v0.0.0-20190308221718-c2843e01d9a2
Fixed in Version: 0.0.0-20201216223049-8b5274cf687f
Vulnerability: CVE-2020-7919
Severity: High
nvd: 7.5
redhat: 7.5
Package: golang.org/x/crypto
Current Version: v0.0.0-20190308221718-c2843e01d9a2
Fixed in Version: 0.0.0-20200124225646-8b5121be2f68
Vulnerability: CVE-2020-9283
Severity: High
nvd: 7.5
redhat: 7.5
Package: golang.org/x/crypto
Current Version: v0.0.0-20190308221718-c2843e01d9a2
Fixed in Version: 0.0.0-20200220183623-bac4c82f6975
Vulnerability: CVE-2021-43565
Severity: High
nvd: 7.5
redhat: 7.5
Package: golang.org/x/crypto
Current Version: v0.0.0-20190308221718-c2843e01d9a2
Fixed in Version: 0.0.0-20211202192323-5770296d904e
Vulnerability: CVE-2022-27191
Severity: High
nvd: 7.5
redhat: 7.5
Package: golang.org/x/crypto
Current Version: v0.0.0-20190308221718-c2843e01d9a2
Fixed in Version: 0.0.0-20220314234659-1baeb1ce4c0b
Vulnerability: CVE-2020-8911
Severity: Medium
nvd: 5.6
redhat: 5.6
Package: github.com/aws/aws-sdk-go
Current Version: v1.30.29
Fixed in Version:
Vulnerability: CVE-2019-11254
Severity: Medium
nvd: 6.5
redhat: 6.5
Package: github.com/go-yaml/yaml
Current Version: v2.1.0+incompatible
Fixed in Version:
Vulnerability: CVE-2019-11840
Severity: Medium
nvd: 5.9
redhat: 5.9
Package: golang.org/x/crypto
Current Version: v0.0.0-20190308221718-c2843e01d9a2
Fixed in Version: 0.0.0-20190320223903-b7391e95e576
Vulnerability: CVE-2021-4235
Severity:
nvd:
redhat: github.com/go-yaml/yaml
Package:
Current Version: v2.1.0+incompatibleNo
Fixed in Version:
Vulnerability: CVE-2022-2582
Severity:
nvd:
redhat:
Package: github.com/aws/aws-sdk-go
Current Version: v1.30.29
Fixed in Version:
Vulnerability: CVE-2020-8912
Severity: Low
nvd: 2.5
redhat: 2.5
Package: github.com/aws/aws-sdk-go
Current Version: v1.30.29
Fixed in Version:
Hi,
I am using a template as below:
作者:
姓名: {{ .author.name }}
邮件: {{ .author.email }}
frep /path/to/template -e "author.name=应卓" -e "[email protected]" --dryrun
output:
作者:
姓名: <no value>
邮件: <no value>
I was wondering maybe if the key contains .
will cause golang's template rendering bug.
frep version:
Name: frep
Version: 1.3.7
Patches: 68
Git branch: tags/v1.3.7
Git commit: 9eca7e8f14390b28f08255bb34d987dffd3f9b10
Built: Tue, 19 Mar 2019 07:11:21 +0000
Go version: go1.11
OS/Arch: darwin/amd64
当使用load 读取文件的时候,只能遍历文件内容,是否可以使用 values 获取所有数据?
Hi, I would like to use this in a CI environment. Can you publish a docker image to docker hub when you create releases please?
Let me know if you would like any help.
If you have issues with using Travis to automate this, check out http://beta.drone.io/ (it has flexible config) (example CI config: https://github.com/drone-plugins/drone-docker/blob/master/.drone.yml).
I do know this is NOT a bug of frep itself.
template :
{{ len "中文" }}
if i run frep like this:
frep /path/to/template --dryrun
i got :
6
So, I think chines users need a new func.
How about:
func CountRune(s string) int {
return len([]rune(s))
}
and register is:
funcMap := template.FuncMap() {
"countRune": CountRune,
// other funcs
}
Missing vars in included file does not rise error with --missing error.
$ more a.in b.in | cat
::::::::::::::
a.in
::::::::::::::
{{- include "b.in" -}}
::::::::::::::
b.in
::::::::::::::
var1={{.var1}}
$ frep --no-sys-env --missing error --overwrite b.in:b.out
fatal: render template error, caused:
template: b.in:1:7: executing "b.in" at <.var1>: map has no entry for key "var1"
$ frep --no-sys-env --missing error --overwrite a.in:a.out
$ cat a.out
var1=<no value>
$
as #10 is merged, would you mind publishing another release to have shiny portable linux binaries ? 😄
Any chance we could get ARM (v7 and arm64) builds here? Love the package BTW, great work!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.