Skip to content

Commit

Permalink
Added new artifact parameter type: server_metadata (Velocidex#2494)
Browse files Browse the repository at this point in the history
This allows the artifact compiler to automatically fill in artifact
parameter values from the server metadata making it easy to manage
  • Loading branch information
scudette authored Mar 4, 2023
1 parent 5cac4cb commit a9bca78
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions services/launcher/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ func (self *Launcher) CompileSingleArtifact(
escaped_name, maybeEscape(name+"_")),
})

case "server_metadata":
client_info_manager, err := services.GetClientInfoManager(config_obj)
if err == nil {
md, err := client_info_manager.GetMetadata(ctx, "server")
if err == nil {
value, pres := md.GetString(name)
if pres {
result.Env[len(result.Env)-1].Value = value
}
}
}

case "int", "int64", "integer":
result.Query = append(result.Query, &actions_proto.VQLRequest{
VQL: fmt.Sprintf("LET %v <= int(int=%v)", escaped_name,
Expand Down

0 comments on commit a9bca78

Please sign in to comment.