renames Box
config key to Web
This commit is contained in:
parent
63a16a3253
commit
f94f6962f5
@ -78,8 +78,8 @@ func init() {
|
||||
}
|
||||
|
||||
// Defaults.
|
||||
viper.SetDefault("box.hostname", "localhost")
|
||||
viper.SetDefault("box.port", 9999)
|
||||
viper.SetDefault("web.hostname", "localhost")
|
||||
viper.SetDefault("web.port", 9999)
|
||||
viper.SetDefault("mpd.hostname", "localhost")
|
||||
viper.SetDefault("mpd.port", 6600)
|
||||
viper.SetDefault("reader.dev", "/dev/hidraw0")
|
||||
@ -97,8 +97,8 @@ func init() {
|
||||
"debug.pprof": rootCmd.PersistentFlags().Lookup("pprof"),
|
||||
"reader.dev": prepareCmd.Flags().Lookup("rfid-reader"),
|
||||
"reader.ignore": runCmd.Flags().Lookup("ignore-reader"),
|
||||
"box.hostname": timerCmd.Flags().Lookup("hostname"),
|
||||
"box.port": timerCmd.Flags().Lookup("port"),
|
||||
"web.hostname": timerCmd.Flags().Lookup("hostname"),
|
||||
"web.port": timerCmd.Flags().Lookup("port"),
|
||||
"timer.duration": timerCmd.Flags().Lookup("duration"),
|
||||
} {
|
||||
if err := viper.BindPFlag(k, v); err != nil {
|
||||
|
@ -20,11 +20,11 @@ type Config struct {
|
||||
Dev string `mapstructure:"Dev"`
|
||||
} `mapstructure:"Reader"`
|
||||
|
||||
// Box is used to configure a webinterface.
|
||||
Box struct {
|
||||
// Web is used to configure the webinterface.
|
||||
Web struct {
|
||||
Hostname string `mapstructure:"Hostname"`
|
||||
Port int `mapstructure:"Port"`
|
||||
} `mapstructure:"Box"`
|
||||
} `mapstructure:"Web"`
|
||||
|
||||
// MPD contains the connection details for the Music Player Daemon.
|
||||
MPD struct {
|
||||
|
@ -58,7 +58,7 @@ func (t *Timer) Handle() {
|
||||
|
||||
// Run is the command line interface for triggering the timer.
|
||||
func Run(cmd *cobra.Command, args []string) {
|
||||
conn, err := grpcclient.Conn(config.Cfg.Box.Hostname, config.Cfg.Box.Port)
|
||||
conn, err := grpcclient.Conn(config.Cfg.Web.Hostname, config.Web.Box.Port)
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("could not connect")
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ func gw(s *grpc.Server, conn string) *runtime.ServeMux {
|
||||
|
||||
func Run(command *cobra.Command, args []string) {
|
||||
// Create host string for serving web.
|
||||
lh := fmt.Sprintf("%s:%d", config.Cfg.Box.Hostname, config.Cfg.Box.Port)
|
||||
lh := fmt.Sprintf("%s:%d", config.Cfg.Web.Hostname, config.Cfg.Web.Port)
|
||||
|
||||
// Create grpc server.
|
||||
grpcServer := grpc.NewServer(
|
||||
|
Loading…
Reference in New Issue
Block a user