Added get config message

master
xSmurf 10 years ago
parent 9f81491fc6
commit 820a31d253

@ -1,6 +1,7 @@
package daemon
import (
"encoding/json"
"fmt"
"os"
"os/signal"
@ -33,6 +34,7 @@ func Main() {
err := runServer(
d.log,
d.handlePing,
d.handleGetConfig,
d.handleListProfiles,
d.handleLaunch,
d.handleListSandboxes,
@ -164,6 +166,15 @@ func (d *daemonState) handlePing(msg *PingMsg, m *ipc.Message) error {
return m.Respond(&PingMsg{msg.Data})
}
func (d *daemonState) handleGetConfig(msg *GetConfigMsg, m *ipc.Message) error {
d.Debug("received get config with data [%s]", msg.Data)
jdata, err := json.Marshal(d.config)
if err != nil {
return m.Respond(&ErrorMsg{err.Error()})
}
return m.Respond(&GetConfigMsg{string(jdata)})
}
func (d *daemonState) handleListProfiles(msg *ListProfilesMsg, m *ipc.Message) error {
r := new(ListProfilesResp)
index := 1

@ -16,6 +16,10 @@ type PingMsg struct {
Data string "Ping"
}
type GetConfigMsg struct {
Data string "GetConfig"
}
type ListProfilesMsg struct {
_ string "ListProfiles"
}
@ -83,6 +87,7 @@ var messageFactory = ipc.NewMsgFactory(
new(PingMsg),
new(OkMsg),
new(ErrorMsg),
new(GetConfigMsg),
new(ListProfilesMsg),
new(ListProfilesResp),
new(LaunchMsg),

Loading…
Cancel
Save