Skip to content

Latest commit

 

History

History
57 lines (40 loc) · 1.03 KB

file-provider.md

File metadata and controls

57 lines (40 loc) · 1.03 KB

File provider

Overview

The File provider in Secret-Init can load secrets from local files.

Prerequisites

  • Golang >= 1.21
  • Makefile

Environment setup

# Create a folder for the example assets
mkdir -p example

Prepare File provider

# Create secrets for the file provider
printf "secret-value" >> "example/secret-file"
printf "super-secret-value" >> "example/super-secret-value"

#NOTE: Optionally you can set a mount path for the file provider by using the FILE_MOUNT_PATH environment variable.

Define secrets to inject

# Export environment variables
export FILE_SECRET_1=file:$PWD/example/secret-file
export FILE_SECRET_2=file:$PWD/example/super-secret-value

Run secret-init

# Build the secret-init binary
make build

# Run secret-init with a command e.g.
./secret-init env | grep 'FILE_SECRET_1\|FILE_SECRET_2'

Cleanup

# Remove files and binary
rm -rd example/
rm -rf secret-init

# Unset the environment variables
unset FILE_SECRET_1
unset FILE_SECRET_2