Skip to content

Commit

Permalink
Read protected file content from config
Browse files Browse the repository at this point in the history
  • Loading branch information
puneetsarna committed Dec 4, 2024
1 parent 92ce8d0 commit 367d995
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions internal/services/nginx/nginx_configuration_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,21 @@ func (m ConfigurationResource) Read() sdk.ResourceFunc {

// GET returns protected files with virtual_path only without content
if files := prop.ProtectedFiles; files != nil {
configs := []ProtectedFile{}
for _, file := range *files {
output.ProtectedFile = append(output.ProtectedFile, ProtectedFile{
config := ProtectedFile{
VirtualPath: pointer.ToString(file.VirtualPath),
})
}
for _, protectedFile := range output.ProtectedFile {
if protectedFile.VirtualPath == pointer.ToString(file.VirtualPath) {
config.Content = protectedFile.Content
break
}
}
configs = append(configs, config)
}
if len(configs) > 0 {
output.ProtectedFile = configs
}
}
}
Expand Down

0 comments on commit 367d995

Please sign in to comment.