🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

github.com/moensch/confclient

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/moensch/confclient

v0.0.0-20161023073013-80d2697b4bfa
Source
Go
Version published
Created
Source

confclient

Build Status

Example client implementation and template parser for confmgr

confadm Usage

conftpl Usage

Get string variable

conftpl -u http://confmgr:8080 -s somestringkey
conftpl -u http://confmgr:8080 -s somehash/field
conftpl -u http://confmgr:8080 -s somelist/index/0

Template processing

conftpl -u http://confmgr:8080 -t my_template.tmpl > my_template.output

With verification

Note: The "FILE" parameter will be replaced with the parsed template output file

conftpl -u http://confmgr:8080 -t some_xml.tmpl -v -- xmllint --format FILE > some_xml.xml

Building

go get github.com/moensch/confmgr/cmd/conftpl
go get github.com/moensch/confmgr/cmd/confadm

Template functions

  • key "keyName" "defaultValue"
    • Gets a given key, optionally fall back to default value
    • Use "keyName/field" to retrieve hash fields
    • Use "keyName/index/n" to retrieve a list item
  • keyd "keyName" "defaultValue"
    • Same as the above, but it will return a hash with "Value" and "Source" to show value origin
  • list "keyName"
    • Retrieve a list
  • listd "keyName"
    • Same as the above, but each list item will be a hash with "Value" and "Source"
  • listj "keyName" "joinChar"
    • Retrieve a list, but return as a string, joined by "joinChar"
  • hash "keyName"
    • Retrieve a hash
    • Always sets "Source" hash key

Examples

key

Hello: {{key "name" "Stranger"}}

keyd

{{with keyd "name" "Stranger"}}
Hello {{.Value}} (key stored at {{.Source}}
{{end}}

list

{{range list "people"}}
  Hello {{.}}
{{end}}

listd

{{range listd "people"}}
  Hello {{.Value}} (From: {{.Source}})
{{end}}

listj

I welcome the following people: {{listj "people" ", "}}

hash

{{range hash "db_settings"}}
  <!-- From: {{.Source}} -->
  <attr key='{{.Key}}' val='{{.Value}}'/>{{end}}

FAQs

Package last updated on 23 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts