예제 #1
0
func NewScoreInfoConfig() (config *configureit.Config) {
	config = configureit.New()

	config.Add("interface", configureit.NewStringOption("env"))
	config.Add("dir", configureit.NewStringOption(""))
	config.Add("path", configureit.NewStringOption("/usr/bin:/bin"))
	config.Add("user", configureit.NewUserOption(""))

	return config
}
예제 #2
0
파일: config.go 프로젝트: anchor/orchestra
// config.go
//
// configuration file handling for orchestra.

package main

import (
	"crypto/tls"
	"crypto/x509"
	"github.com/kuroneko/configureit"
	o "orchestra"
	"os"
	"strings"
)

var configFile = configureit.New()

func init() {
	configFile.Add("x509 certificate", configureit.NewStringOption("/etc/orchestra/player_crt.pem"))
	configFile.Add("x509 private key", configureit.NewStringOption("/etc/orchestra/player_key.pem"))
	configFile.Add("ca certificates", configureit.NewPathListOption(nil))
	configFile.Add("master", configureit.NewStringOption("conductor"))
	configFile.Add("score directory", configureit.NewStringOption("/usr/lib/orchestra/scores"))
	configFile.Add("player name", configureit.NewStringOption(""))
}

func GetStringOpt(key string) string {
	cnode := configFile.Get(key)
	if cnode == nil {
		o.Assert("tried to get a configuration option that doesn't exist.")
	}
예제 #3
0
package main

import (
	"bufio"
	"github.com/kuroneko/configureit"
	o "orchestra"
	"os"
	"strings"
)

var configFile *configureit.Config = configureit.New()

func init() {
	configFile.Add("x509 certificate", configureit.NewStringOption("/etc/orchestra/conductor_crt.pem"))
	configFile.Add("x509 private key", configureit.NewStringOption("/etc/orchestra/conductor_key.pem"))
	configFile.Add("ca certificates", configureit.NewPathListOption(nil))
	configFile.Add("bind address", configureit.NewStringOption(""))
	configFile.Add("server name", configureit.NewStringOption(""))
	configFile.Add("audience socket path", configureit.NewStringOption("/var/run/conductor.sock"))
	configFile.Add("conductor state path", configureit.NewStringOption("/var/spool/orchestra"))
	configFile.Add("player file path", configureit.NewStringOption("/etc/orchestra/players"))
}

func GetStringOpt(key string) string {
	cnode := configFile.Get(key)
	if cnode == nil {
		o.Assert("tried to get a configuration option that doesn't exist.")
	}
	sopt, ok := cnode.(*configureit.StringOption)
	if !ok {
		o.Assert("tried to get a non-string configuration option with GetStringOpt")