blob: ba6b33bb0960e0bb911062103f3483f8d3d8f8f2 [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Daemon groupsd implements the interfaces for
// managing access control groups.
package main
// Example invocation:
// groupsd --v23.tcp.address="" --name=groupsd
import (
_ ""
var (
flagName string
flagEngine string
flagRootDir string
flagPersist string
func main() {
cmdGroupsD.Flags.StringVar(&flagName, "name", "", "Name to mount the groups server as.")
cmdGroupsD.Flags.StringVar(&flagEngine, "engine", "memstore", "Storage engine to use. Currently supported: leveldb, and memstore.")
cmdGroupsD.Flags.StringVar(&flagRootDir, "root-dir", "/var/lib/groupsd", "Root dir for storage engines and other data.")
var cmdGroupsD = &cmdline.Command{
Runner: v23cmd.RunnerFunc(runGroupsD),
Name: "groupsd",
Short: "Runs the groups daemon.",
Long: `
Command groupsd runs the groups daemon, which implements the interface.
func runGroupsD(ctx *context.T, env *cmdline.Env, args []string) error {
dispatcher, err := lib.NewGroupsDispatcher(flagRootDir, flagEngine)
if err != nil {
return err
ctx, server, err := v23.WithNewDispatchingServer(ctx, flagName, dispatcher)
if err != nil {
return fmt.Errorf("NewDispatchingServer(%v) failed: %v", flagName, err)
ctx.Infof("Groups server running at endpoint=%q", server.Status().Endpoints[0].Name())
// Wait until shutdown.
return nil