Add: Server variables are opt-out by default
- Pull the Nushell and Deno versions from the server. - Support downloading Nushell and Deno from a url (not GitHUb). - Add support for nu config.nu and env.nu files. - Add support for default Deno permissions.
This commit is contained in:
parent
87e1b29ef6
commit
2afdfd7ab8
11 changed files with 610 additions and 387 deletions
56
agent/svc.go
56
agent/svc.go
|
|
@ -29,15 +29,23 @@ func (a *Agent) RunAsService(nc *nats.Conn) {
|
|||
}
|
||||
|
||||
type AgentCheckInConfig struct {
|
||||
Hello int `json:"checkin_hello"`
|
||||
AgentInfo int `json:"checkin_agentinfo"`
|
||||
WinSvc int `json:"checkin_winsvc"`
|
||||
PubIP int `json:"checkin_pubip"`
|
||||
Disks int `json:"checkin_disks"`
|
||||
SW int `json:"checkin_sw"`
|
||||
WMI int `json:"checkin_wmi"`
|
||||
SyncMesh int `json:"checkin_syncmesh"`
|
||||
LimitData bool `json:"limit_data"`
|
||||
Hello int `json:"checkin_hello"`
|
||||
AgentInfo int `json:"checkin_agentinfo"`
|
||||
WinSvc int `json:"checkin_winsvc"`
|
||||
PubIP int `json:"checkin_pubip"`
|
||||
Disks int `json:"checkin_disks"`
|
||||
SW int `json:"checkin_sw"`
|
||||
WMI int `json:"checkin_wmi"`
|
||||
SyncMesh int `json:"checkin_syncmesh"`
|
||||
LimitData bool `json:"limit_data"`
|
||||
InstallNushell bool `json:"install_nushell"`
|
||||
InstallNushellVersion string `json:"install_nushell_version"`
|
||||
InstallNushellUrl string `json:"install_nushell_url"`
|
||||
NushellEnableConfig bool `json:"nushell_enable_config"`
|
||||
InstallDeno bool `json:"install_deno"`
|
||||
InstallDenoVersion string `json:"install_deno_version"`
|
||||
InstallDenoUrl string `json:"install_deno_url"`
|
||||
DenoDefaultPermissions string `json:"deno_default_permissions"`
|
||||
}
|
||||
|
||||
func (a *Agent) AgentSvc(nc *nats.Conn) {
|
||||
|
|
@ -49,8 +57,6 @@ func (a *Agent) AgentSvc(nc *nats.Conn) {
|
|||
a.Logger.Errorln("AgentSvc() createWinTempDir():", err)
|
||||
}
|
||||
}
|
||||
a.GetNushell(false)
|
||||
a.GetDeno(false)
|
||||
|
||||
a.RunMigrations()
|
||||
|
||||
|
|
@ -64,8 +70,9 @@ func (a *Agent) AgentSvc(nc *nats.Conn) {
|
|||
a.CleanupAgentUpdates()
|
||||
}
|
||||
|
||||
// Windows has GetAgentCheckInConfig() while unix has a stub GetAgentCheckInConfig()
|
||||
conf := a.GetAgentCheckInConfig(a.GetCheckInConfFromAPI())
|
||||
a.Logger.Debugf("+%v\n", conf)
|
||||
a.Logger.Debugf("AgentCheckInConf: %+v\n", conf)
|
||||
for _, s := range natsCheckin {
|
||||
if conf.LimitData && stringInSlice(s, limitNatsData) {
|
||||
continue
|
||||
|
|
@ -75,6 +82,15 @@ func (a *Agent) AgentSvc(nc *nats.Conn) {
|
|||
}
|
||||
}
|
||||
|
||||
// The server conf check is also done in the functions to keep the parameters the same.
|
||||
// Don't force a download when restarting the service.
|
||||
if conf.InstallNushell {
|
||||
a.InstallNushell(false)
|
||||
}
|
||||
if conf.InstallDeno {
|
||||
a.InstallDeno(false)
|
||||
}
|
||||
|
||||
go a.SyncMeshNodeID()
|
||||
|
||||
time.Sleep(time.Duration(randRange(1, 3)) * time.Second)
|
||||
|
|
@ -142,6 +158,14 @@ func (a *Agent) GetCheckInConfFromAPI() AgentCheckInConfig {
|
|||
ret.WMI = randRange(3000, 4000)
|
||||
ret.SyncMesh = randRange(800, 1200)
|
||||
ret.LimitData = false
|
||||
ret.InstallNushell = false
|
||||
ret.InstallNushellVersion = ""
|
||||
ret.InstallNushellUrl = ""
|
||||
ret.NushellEnableConfig = false
|
||||
ret.InstallDeno = false
|
||||
ret.InstallDenoVersion = ""
|
||||
ret.InstallDenoUrl = ""
|
||||
ret.DenoDefaultPermissions = ""
|
||||
} else {
|
||||
ret.Hello = r.Result().(*AgentCheckInConfig).Hello
|
||||
ret.AgentInfo = r.Result().(*AgentCheckInConfig).AgentInfo
|
||||
|
|
@ -152,6 +176,14 @@ func (a *Agent) GetCheckInConfFromAPI() AgentCheckInConfig {
|
|||
ret.WMI = r.Result().(*AgentCheckInConfig).WMI
|
||||
ret.SyncMesh = r.Result().(*AgentCheckInConfig).SyncMesh
|
||||
ret.LimitData = r.Result().(*AgentCheckInConfig).LimitData
|
||||
ret.InstallNushell = r.Result().(*AgentCheckInConfig).InstallNushell
|
||||
ret.InstallNushellVersion = r.Result().(*AgentCheckInConfig).InstallNushellVersion
|
||||
ret.InstallNushellUrl = r.Result().(*AgentCheckInConfig).InstallNushellUrl
|
||||
ret.NushellEnableConfig = r.Result().(*AgentCheckInConfig).NushellEnableConfig
|
||||
ret.InstallDeno = r.Result().(*AgentCheckInConfig).InstallDeno
|
||||
ret.InstallDenoVersion = r.Result().(*AgentCheckInConfig).InstallDenoVersion
|
||||
ret.InstallDenoUrl = r.Result().(*AgentCheckInConfig).InstallDenoUrl
|
||||
ret.DenoDefaultPermissions = r.Result().(*AgentCheckInConfig).DenoDefaultPermissions
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue