install.fairie/home/dot_config/rclone/merge_rclone.conf
Brian Zalewski d8769e8ad1 Update 16 files
- /home/dot_config/rclone/merge_rclone.conf
- /home/dot_config/rclone/s3-public.service.tmpl
- /home/dot_config/rclone/s3-private.service.tmpl
- /home/dot_config/rclone/s3-docker.service.tmpl
- /home/dot_config/gcp/gcp.json.TODO
- /home/dot_config/docker/plugins.json
- /home/.chezmoitemplates/secrets/key-cloudflare-r2-secret
- /home/.chezmoitemplates/secrets/key-cloudflare-r2-id
- /home/dot_local/bin/executable_rclone-mount
- /home/dot_local/bin/executable_install-program
- /home/.chezmoidata.yaml
- /home/.chezmoiscripts/_universal/run_onchange_before_11-install-docker.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_07-docker-plugins.tmpl
- /home/.chezmoi.yaml.tmpl
- /docs/TODO.md
- /software.yml
2023-01-30 03:09:02 +00:00

60 lines
2.3 KiB
Text

{{- if and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "key-cloudflare-r2-id")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "key-cloudflare-r2-secret")) (ne .user.cloudflare.r2 "") -}}
#!/usr/bin/env bash
CONFIG_FILE="$HOME/.config/rclone/rclone.conf"
if cat "$CONFIG_FILE" | grep '# MEGABYTE LABS MANAGED S3'; then
# TODO: Remove old block
START_LINE="$(echo `grep -n -m 1 "# MEGABYTE LABS MANAGED S3" .zshrc | cut -f1 -d ":"`)"
END_LINE="$(echo `grep -n -m 1 "# MEGABYTE LABS MANAGED S3" .zshrc | cut -f1 -d ":"`)"
if command -v gsed > /dev/null; then
gsed -i "$START_LINE,$END_LINEd" "$CONFIG_FILE"
else
sed -i "$START_LINE,$END_LINEd" "$CONFIG_FILE"
fi
fi
tee -a "$CONFIG_FILE" > /dev/null <<EOT
# MEGABYTE LABS MANAGED S3
[{{ .user.username}}-s3]
type = s3
provider = Cloudflare
access_key_id = {{ includeTemplate "secrets/key-cloudflare-r2-id" | decrypt -}}
secret_access_key = {{ includeTemplate "secrets/key-cloudflare-r2-secret" | decrypt -}}
region = auto
endpoint = https://{{ .user.cloudflare.r2 }}.r2.cloudflarestorage.com/user
acl = private
[docker]
type = s3
provider = Cloudflare
env_auth = false
access_key_id = {{ includeTemplate "secrets/key-cloudflare-r2-id" | decrypt -}}
secret_access_key = {{ includeTemplate "secrets/key-cloudflare-r2-secret" | decrypt -}}
endpoint = open.nyc3.digitaloceanspaces.com
acl = private
[private]
type = s3
provider = Cloudflare
env_auth = false
access_key_id = {{ includeTemplate "secrets/key-cloudflare-r2-id" | decrypt -}}
secret_access_key = {{ includeTemplate "secrets/key-cloudflare-r2-secret" | decrypt -}}
endpoint = {{ }}
acl = private
[public]
type = s3
provider = Cloudflare
env_auth = false
access_key_id = {{ includeTemplate "secrets/key-cloudflare-r2-id" | decrypt -}}
secret_access_key = {{ includeTemplate "secrets/key-cloudflare-r2-secret" | decrypt -}}
endpoint = open.nyc3.digitaloceanspaces.com
acl = public-read
[system]
type = s3
provider = Cloudflare
env_auth = false
access_key_id = {{ includeTemplate "secrets/key-cloudflare-r2-id" | decrypt -}}
secret_access_key = {{ includeTemplate "secrets/key-cloudflare-r2-secret" | decrypt -}}
endpoint = open.nyc3.digitaloceanspaces.com
acl = private
# MEGABYTE LABS MANAGED S3
EOT
{{- end }}