// Package tmpl embeds every file Skiff writes out to the host - jail // config, rc.d script, nginx vhost, git hook - so the whole tool ships as // one binary with nothing extra to install alongside it. package tmpl import ( "bytes" _ "embed" "text/template" ) //go:embed jail.conf.tmpl var jailConf string //go:embed rc.d.tmpl var rcScript string //go:embed nginx-app.conf.tmpl var nginxApp string //go:embed post-receive.tmpl var postReceive string func Render(text string, data any) (string, error) { t, err := template.New("t").Parse(text) if err != nil { return "", err } var buf bytes.Buffer if err := t.Execute(&buf, data); err != nil { return "", err } return buf.String(), nil } type JailConfData struct { Name string JailRoot string IP string Iface string } func JailConf(d JailConfData) (string, error) { return Render(jailConf, d) } type RCData struct{ Name string } func RCScript(d RCData) (string, error) { return Render(rcScript, d) } type NginxAppData struct { Name string IP string Port int ServerName string } func NginxApp(d NginxAppData) (string, error) { return Render(nginxApp, d) } type PostReceiveData struct{ Name string } func PostReceive(d PostReceiveData) (string, error) { return Render(postReceive, d) }