1
0
mirror of https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git synced 2025-12-15 11:22:43 +03:00
2022-11-03 20:13:03 +00:00

27 lines
597 B
Bash

# Google Cloud Instance MetaData Service variables and functions
# vim:set ts=4 et ft=sh:
IMDS_HEADER="Metadata-Flavor"
IMDS_URI="computeMetadata/v1"
IMDS_HOSTNAME="instance/hostname"
IMDS_SSH_KEYS="
project/attributes/ssh-keys
instance/attributes/ssh-keys
"
IMDS_USERDATA="instance/attributes/user-data"
_imds_header() {
echo "$IMDS_HEADER: Google"
}
# merge project and instance keys
_imds_ssh_keys() {
local ssh_keys
for ssh_keys in $IMDS_SSH_KEYS; do
# ignore errors and strip leading '<login>:'
imds -e "$ssh_keys" | cut -d: -f2-
done | sort -u
}