You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
subgraph-oz/config.go

37 lines
709 B

package oz
import (
"encoding/json"
"io/ioutil"
)
type Config struct {
ProfileDir string `json:"profile_dir"`
ShellPath string `json:"shell_path"`
AllowRootShell bool `json:"allow_root_shell"`
LogXpra bool `json:"log_xpra"`
}
const DefaultConfigPath = "/etc/oz/oz.conf"
func NewDefaultConfig() *Config {
return &Config{
ProfileDir: "/var/lib/oz/cells.d",
ShellPath: "/bin/bash",
AllowRootShell: false,
LogXpra: false,
}
}
func LoadConfig(path string) (*Config, error) {
bs, err := ioutil.ReadFile(path)
if err != nil {
return nil, err
}
c := NewDefaultConfig()
if err := json.Unmarshal(bs, c); err != nil {
return nil, err
}
return c, nil
}