mirror of
https://github.com/turbot/steampipe.git
synced 2025-12-19 18:12:43 -05:00
1.8 KiB
1.8 KiB
Workspace Profile (work in progress)
Adding properties to Workspace Profile
Adding simple properties to Workspace Profile
- Add properties to the
WorkspaceProfilestruct inpkg/steampipeconfig/modconfig/workspace_profile.go. - Add
hclandctytags to the properties. (eample:hcl:"search_path" cty:"search_path"). - Add to
(p *WorkspaceProfile) setBaseProperties(). This enablesbaseprofile inheritance. Remember to check fornil. - Add to
(p *WorkspaceProfile) ConfigMap(commandName string).
Adding an options property. Example Commit
Define struct with the following interface
type Query struct {}
// ConfigMap :: this is merged with viper
// Only add keys which are not nil
func (t *Query) ConfigMap() map[string]interface{} {}
// Merge :: merge other options over the top of this options object
// i.e. if a property is set in otherOptions, it takes precedence
func (t *Query) Merge(otherOptions Options) {
// make sure this is the type we want
if _, ok := otherOptions.(*Query); !ok {
return
}
}
// String serialize for printing
func (t *Query) String() string {}
Add struct tags
For properties in the struct which need to be extracted from the HCL, add the following tag
hcl:"output"
where output is the property in the HCL.