Merge pull request #1 from cunningpike/cunningpike

Added local allow and block file support
This commit is contained in:
cunningpike 2023-02-21 15:11:40 -05:00 committed by GitHub
commit b2cfb9659b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 0 deletions

View File

@ -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 }}

View File

@ -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 }}

View File

@ -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: