featurebase/ctl/config.go
Matt Jaffee 77c25eeb06 fix readme and config command for new config style
still need to update readme to include info about environment variables, but at
least it isn't wrong anymore.
2017-03-17 20:42:41 -05:00

48 lines
831 B
Go

package ctl
import (
"context"
"fmt"
"io"
"strings"
"github.com/pilosa/pilosa"
)
// ConfigCommand represents a command for printing a default config.
type ConfigCommand struct {
*pilosa.CmdIO
}
// NewConfigCommand returns a new instance of ConfigCommand.
func NewConfigCommand(stdin io.Reader, stdout, stderr io.Writer) *ConfigCommand {
return &ConfigCommand{
CmdIO: pilosa.NewCmdIO(stdin, stdout, stderr),
}
}
// Run prints out the default config.
func (cmd *ConfigCommand) Run(ctx context.Context) error {
fmt.Fprintln(cmd.Stdout, strings.TrimSpace(`
data-dir = "~/.pilosa"
bind = "localhost:10101"
[cluster]
poll-interval = "2m0s"
replicas = 1
hosts = [
"localhost:10101",
]
[anti-entropy]
interval = "10m0s"
[profile]
cpu = ""
cpu-time = "30s"
[plugins]
path = ""
`)+"\n")
return nil
}