Skip to content

Commit

Permalink
favor maps over lists due to helm list merge limitations
Browse files Browse the repository at this point in the history
Originally, I went with an approach that uses lists of objects.
However, after experiencing some pain with the helm support for combining / overriding lists,
I reverted back to a map-based approach where the key-names have more value.
This is more consistent with the approach we use in fhir-server-config anyway, and so
I went ahead and made them exactly alike so that we can just rely on helm's toJson instead of
writing our own templates for this.

Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
  • Loading branch information
lmsurpre committed Oct 4, 2021
1 parent 3e5bc08 commit 2dd7686
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 46 deletions.
13 changes: 6 additions & 7 deletions charts/ibm-fhir-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,12 @@ If the `objectStorage.objectStorageSecret` value is set, this helm chart will on
| db.tenantKey | string | `nil` | |
| db.type | string | `"postgresql"` | |
| db.user | string | `"postgres"` | |
| endpoints | list | A single entry for resourceType "Resource" that applies to all resource types | Control which interactions are supported for which resource type endpoints |
| endpoints[0].interactions | list | All interactions. | The set of enabled interactions for this resource type: [create, read, vread, history, search, update, patch, delete] |
| endpoints[0].profiles | list | `nil` | Instances of this type must claim conformance to at least one of the listed profiles; nil means no profile conformance required |
| endpoints[0].resourceType | string | `"Resource"` | A valid FHIR resource type; use "Resource" for whole-system behavior |
| endpoints[0].searchIncludes | list | `nil` | Valid _include arguments while searching this resource type; nil means no restrictions |
| endpoints[0].searchParameters | list | `[{"code":"*","url":"*"}]` | A mapping from enabled search parameter codes to search parameter definitions |
| endpoints[0].searchRevIncludes | list | `nil` | Valid _revInclude arguments while searching this resource type; nil means no restrictions |
| endpoints | object | A single entry for resourceType "Resource" that applies to all resource types | Control which interactions are supported for which resource type endpoints |
| endpoints.Resource.interactions | list | All interactions. | The set of enabled interactions for this resource type: [create, read, vread, history, search, update, patch, delete] |
| endpoints.Resource.profiles.atLeastOne | list | `nil` | Instances of this type must claim conformance to at least one of the listed profiles; nil means no profile conformance required |
| endpoints.Resource.searchIncludes | list | `nil` | Valid _include arguments while searching this resource type; nil means no restrictions |
| endpoints.Resource.searchParameters | object | `{"*":"*"}` | A mapping from enabled search parameter codes to search parameter definitions |
| endpoints.Resource.searchRevIncludes | list | `nil` | Valid _revInclude arguments while searching this resource type; nil means no restrictions |
| extensionSearchParametersTemplate | string | `"defaultSearchParameters"` | Template containing the extension-search-parameters.json content |
| extraEnv | string | `""` | |
| extraJvmOptions | string | `""` | |
Expand Down
33 changes: 2 additions & 31 deletions charts/ibm-fhir-server/templates/_fhirServerConfigJson.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,8 @@ The default fhir-server-config.json.
},
"resources": {
"open": {{ not .Values.restrictEndpoints }}
{{- range $i, $endpoint := .Values.endpoints }}
{{- if $endpoint.resourceType }},
"{{ $endpoint.resourceType }}": {
{{- if $endpoint.searchIncludes }}
"searchIncludes": {{ toJson $endpoint.searchIncludes }}
{{- end}}
{{- if $endpoint.searchRevIncludes }}
{{- if $endpoint.searchIncludes }},{{- end }}
"searchRevIncludes": {{ toJson $endpoint.searchRevIncludes }}
{{- end}}
{{- if $endpoint.profiles }}
{{- if or $endpoint.searchIncludes $endpoint.searchRevIncludes }},{{- end }}
"profiles": {
"atLeastOne": {{ toJson $endpoint.profiles }}
}
{{- end}}
{{- if $endpoint.searchParameters }}
{{- if or $endpoint.searchIncludes $endpoint.searchRevIncludes $endpoint.searchProfiles }},{{- end }}
"searchParameters": {
{{- $lastIndex := sub (len $endpoint.searchParameters) 1 }}
{{- range $j, $param := $endpoint.searchParameters }}
"{{ $param.code }}": "{{ $param.url }}"{{ if not (eq $j $lastIndex) }},{{ end }}
{{- end }}
}
{{- end}}
{{- if $endpoint.interactions }}
{{- if or $endpoint.searchIncludes $endpoint.searchRevIncludes $endpoint.searchProfiles $endpoint.searchParameters }},{{- end }}
"interactions": {{ toJson $endpoint.interactions }}
{{- end}}
}
{{- end }}
{{- range $endpoint, $conf := .Values.endpoints }},
"{{ $endpoint }}": {{ toPrettyJson $conf | indent 16 }}
{{- end }}
},
"security": {
Expand Down
17 changes: 9 additions & 8 deletions charts/ibm-fhir-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,20 @@ restrictEndpoints: false
# -- Control which interactions are supported for which resource type endpoints
# @default -- A single entry for resourceType "Resource" that applies to all resource types
endpoints:
# yamllint disable-line rule:comments
- # -- A valid FHIR resource type; use "Resource" for whole-system behavior
resourceType: Resource
# -- (list) Valid _include arguments while searching this resource type; nil means no restrictions
Resource:
# -- (list) Valid _include arguments while searching this resource type;
# nil means no restrictions
searchIncludes:
# -- (list) Valid _revInclude arguments while searching this resource type; nil means no restrictions
# -- (list) Valid _revInclude arguments while searching this resource type;
# nil means no restrictions
searchRevIncludes:
# -- (list) Instances of this type must claim conformance to at least one of the listed profiles; nil means no profile conformance required
profiles:
# -- (list) Instances of this type must claim conformance to at least one of the listed profiles;
# nil means no profile conformance required
atLeastOne:
# -- A mapping from enabled search parameter codes to search parameter definitions
searchParameters:
- code: "*"
url: "*"
"*": "*"
# -- The set of enabled interactions for this resource type:
# [create, read, vread, history, search, update, patch, delete]
# @default -- All interactions.
Expand Down

0 comments on commit 2dd7686

Please sign in to comment.