adding theater-mode, fixes #15

This commit is contained in:
Edmund Huber 2014-03-13 09:55:46 +01:00
parent a3df727c47
commit d5bdc78d55
10 changed files with 212 additions and 31 deletions

View file

@ -29,6 +29,8 @@ type Config struct {
}
Operator map[string]*PassConfig
Theater map[string]*PassConfig
}
func (conf *Config) Operators() map[Name][]byte {
@ -39,6 +41,18 @@ func (conf *Config) Operators() map[Name][]byte {
return operators
}
func (conf *Config) Theaters() map[Name][]byte {
theaters := make(map[Name][]byte)
for s, theaterConf := range conf.Theater {
name := NewName(s)
if !name.IsChannel() {
log.Fatal("config uses a non-channel for a theater!")
}
theaters[name] = theaterConf.PasswordBytes()
}
return theaters
}
func LoadConfig(filename string) (config *Config, err error) {
config = &Config{}
err = gcfg.ReadFileInto(config, filename)