Commit graph

62 commits

Author SHA1 Message Date
Matt Jaffee
372b7ca1c4 full testing support for pilosa server
1. fixed a couple bugs with config file reading.
2. made cmd.Serve a global variable so tests could inspect it.
3. added table style testing for pilosa server
4. added the ability to stop server programmatically which also causes the cobra
command running it to return.
2017-03-17 16:43:04 -05:00
Matt Jaffee
961d18a3bf convert all subcommands to nonglobal style 2017-03-17 16:43:04 -05:00
Matt Jaffee
943e8ece1e add data-dir flag and simplify server/server.go
Now that the default data dir is defined by the flag, we don't need to set it
explicitly if it isn't set. We also stop reading the config file explicitly in
server.go since viper will read it - we do need to define all the config options
though before the config file will work properly.
2017-03-17 16:43:04 -05:00
Matt Jaffee
26a900843a move setAllConfig and it's invocation to root cmd 2017-03-17 16:43:04 -05:00
Matt Jaffee
232cf53781 rename config function and have it return error 2017-03-17 16:43:04 -05:00
Matt Jaffee
e1a582ad2c experimenting with cascading config
2 changes unrelated to cascading config:

1. using cobra.Command.RunE instead of just Run - similar behavior to log + exit,
but simpler. Also prints error message, then usage, then error again which is
nice.

2. getting serveCmd.Flags() once, and re-using it. More readable methinks.

For cascading config, I'm trying to set things up so that we can define the
flags once, and have them work from a config file, environment variable, or
command line. I also don't want references to viper scattered throughout our
code, so I want to set the config at startup, and not touch it from then on.

The idea here is to iterate through the set up command line flags, and then set
their values from viper which knows about the commmand line, the environment,
and the config file, and will pick the right one. The command line flags were
set pointing to the correct config values in the pilosa object, so the right
values will be set automatically.
2017-03-17 16:43:04 -05:00
Matt Jaffee
72de534c8c remove duplicate Version/BuildTime from pilosa/server
use only the pilosa/cmd Version and BuildTime which are populated by the ldflags
in the Makefile
2017-03-09 11:39:11 -06:00
Matt Jaffee
fa9586f64f remove useless print 2017-03-07 13:18:51 -06:00
Matt Jaffee
555a514e37 code review tweaks 2017-03-07 11:30:31 -06:00
Matt Jaffee
c7caea6b30 fix short help strings on commands 2017-03-06 16:45:37 -06:00
Matt Jaffee
756c44c17d fix bugs with pilosa server -config and remove dead code 2017-03-06 10:19:50 -06:00
Matt Jaffee
02c3c6d3e6 use cobra/viper and move cmd/pilosa to server subcommand 2017-03-03 13:03:57 -06:00