Example #1
0
func loadProperties(path string) (p *properties.Properties, err error) {
	if path == "" {
		return properties.NewProperties(), nil
	}
	if strings.HasPrefix(path, "http://") || strings.HasPrefix(path, "https://") {
		return properties.LoadURL(path)
	}
	return properties.LoadFile(path, properties.UTF8)
}
Example #2
0
func Load(filename string) (*Config, error) {
	if filename == "" {
		return fromProperties(properties.NewProperties())
	}

	p, err := properties.LoadFile(filename, properties.UTF8)
	if err != nil {
		return nil, err
	}
	return fromProperties(p)
}
Example #3
0
// Set's session manager configuration.
func (s *SessionManager) SetConfig(props *properties.Properties) {
	for _, k := range props.Keys() {
		parts := strings.Split(k, ".")
		alias := parts[1]
		config := s.configMap[alias]
		if config == nil {
			config = properties.NewProperties()
			config.Set("alias", alias)
			s.configMap[alias] = config
		}
		config.Set(parts[2], props.MustGet(k))
	}
}