mirror of
https://github.com/Luzifer/vault-openvpn.git
synced 2024-12-25 14:21:21 +00:00
Allow path to templates to be configured
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
bf3f4fafe1
commit
3874e1dc79
1 changed files with 4 additions and 1 deletions
5
main.go
5
main.go
|
@ -8,6 +8,7 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"sort"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
@ -46,6 +47,7 @@ var (
|
|||
CertTTL time.Duration `flag:"ttl" vardefault:"ttl" description:"Set the TTL for this certificate"`
|
||||
|
||||
LogLevel string `flag:"log-level" vardefault:"log-level" description:"Log level to use (debug, info, warning, error)"`
|
||||
TemplatePath string `flag:"template-path" vardefault:"template-path" description:"Path to read the client.conf / server.conf template from"`
|
||||
VersionAndExit bool `flag:"version" default:"false" description:"Prints current version and exits"`
|
||||
}{}
|
||||
|
||||
|
@ -55,6 +57,7 @@ var (
|
|||
"auto-revoke": "true",
|
||||
"ttl": "8760h",
|
||||
"log-level": "info",
|
||||
"template-path": ".",
|
||||
}
|
||||
|
||||
version = "dev"
|
||||
|
@ -281,7 +284,7 @@ func generateCertificateConfig(tplName, fqdn string) error {
|
|||
}
|
||||
|
||||
func renderTemplate(tplName string, tplv *templateVars) error {
|
||||
raw, err := ioutil.ReadFile(tplName)
|
||||
raw, err := ioutil.ReadFile(path.Join(cfg.TemplatePath, tplName))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue