diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl index 78e6610..3ee4c22 100644 --- a/chart/templates/_helpers.tpl +++ b/chart/templates/_helpers.tpl @@ -68,3 +68,25 @@ Create the default conf file path and filename {{- define "fediblockhole.conf_file_filename" -}} {{- default "fediblockhole.conf.toml" .Values.fediblockhole.conf_file.filename }} {{- end }} + +{{/* +Create the default allowlist file path and filename +*/}} +{{- define "fediblockhole.allow_file_path" -}} +{{- default "/etc/default/" .Values.fediblockhole.allow_file.path }} +{{- end }} +{{- define "fediblockhole.allow_file_filename" -}} +{{- default "allowlist.csv" .Values.fediblockhole.allow_file.filename }} +{{- end }} + +{{/* +Create the blocklist file path and filename +*/}} +{{- if .Values.fediblockhole.block_file.path && .Values.fediblockhole.block_file.filename }} +{{- define "fediblockhole.block_file_path" -}} +{{- .Values.fediblockhole.block_file.path }} +{{- end }} +{{- define "fediblockhole.block_file_filename" -}} +{{- .Values.fediblockhole.block_file.filename }} +{{- end }} +{{- end }} diff --git a/chart/templates/cronjob-fediblock-sync.yaml b/chart/templates/cronjob-fediblock-sync.yaml index 41ef63b..2069563 100644 --- a/chart/templates/cronjob-fediblock-sync.yaml +++ b/chart/templates/cronjob-fediblock-sync.yaml @@ -31,6 +31,12 @@ spec: volumeMounts: - name: config mountPath: {{ include "fediblockhole.conf_file_path" . | quote }} + - name: allow + mountPath: {{ include "fediblockhole.allow_file_path" . | quote }} + {{- with fediblockhole.block_file_path }} + - name: block + mountPath: {{ . | quote }} + {{ end }} volumes: - name: config configMap: @@ -38,4 +44,20 @@ spec: items: - key: {{ include "fediblockhole.conf_file_filename" . | quote }} path: {{ include "fediblockhole.conf_file_filename" . | quote }} + - name: allow + configMap: + name: {{ include "fediblockhole.fullname" . }}-allow-csv + items: + - key: {{ include "fediblockhole.allow_file_filename" . | quote }} + path: {{ include "fediblockhole.allow_file_filename" . | quote }} + {{- with fediblockhole.block_file_path }} + - name: block + configMap: + name: {{ include "fediblockhole.fullname" . }}-block-csv + {{- with fediblockhole.block_file_filename }} + items: + - key: {{ . | quote }} + path: {{ . | quote }} + {{ end }} + {{end }} {{- end }} diff --git a/chart/values.yaml b/chart/values.yaml index ab8b3f4..674af2b 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -15,6 +15,15 @@ fediblockhole: conf_file: path: "" filename: "" + # location of the local allowlist file. Default is /etc/default/allowlist.csv. + # This file should at a minimum contain the web_domain of your own instance. + allow_file: + path: "" + filename: "" + # location of the local blocklist file. + block_file: + path: "" + filename: "" cron: # -- run `fediblock-sync` every hour sync: