Beispiel #1
0
func goNamespaceOptions(env jutil.Env, jOptions jutil.Object) ([]naming.NamespaceOpt, error) {
	var opts []naming.NamespaceOpt
	r, err := jutil.GetBooleanOption(env, jOptions, "io.v.v23.naming.REPLACE_MOUNT")
	if err != nil {
		return nil, err
	}
	opts = append(opts, naming.ReplaceMount(r))
	s, err := jutil.GetBooleanOption(env, jOptions, "io.v.v23.naming.SERVES_MOUNT_TABLE")
	if err != nil {
		return nil, err
	}
	opts = append(opts, naming.ServesMountTable(s))
	l, err := jutil.GetBooleanOption(env, jOptions, "io.v.v23.naming.IS_LEAF")
	if err != nil {
		return nil, err
	}
	opts = append(opts, naming.IsLeaf(l))
	e, err := jutil.GetBooleanOption(env, jOptions, "io.v.v23.SKIP_SERVER_ENDPOINT_AUTHORIZATION")
	if err != nil {
		return nil, err
	}
	if e {
		opts = append(opts, options.NameResolutionAuthorizer{security.AllowEveryone()})
	}
	return opts, nil
}
Beispiel #2
0
func loggingOpts(env jutil.Env, jOpts jutil.Object) (dir vlog.LogDir, toStderr vlog.LogToStderr, level vlog.Level, vmodule vlog.ModuleSpec, err error) {
	var d string
	d, err = jutil.GetStringOption(env, jOpts, "io.v.v23.LOG_DIR")
	if err != nil {
		return
	}
	dir = vlog.LogDir(d)
	var s bool
	s, err = jutil.GetBooleanOption(env, jOpts, "io.v.v23.LOG_TO_STDERR")
	if err != nil {
		return
	}
	toStderr = vlog.LogToStderr(s)
	var l int
	l, err = jutil.GetIntOption(env, jOpts, "io.v.v23.LOG_VLEVEL")
	if err != nil {
		return
	}
	level = vlog.Level(l)
	var m string
	m, err = jutil.GetStringOption(env, jOpts, "io.v.v23.LOG_VMODULE")
	if err != nil {
		return
	}
	err = vmodule.Set(m)
	return
}