Skip to content

๐Ÿ—œ Clamp โ€” Replace environment variables in any file using go template syntax

License

Notifications You must be signed in to change notification settings

JulienBreux/clamp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

58 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ—œ Clamp โ€” Replace environment variables in any file using go template syntax

Actions Status Go Report Card codebeat badge GitHub tag Go version

Clamp is a useful tool to help to replace environment variables in any file using go template syntax.


๐Ÿ“˜ Help

How to use from pipe

Locally:

echo "{{ .USER }}" | clamp
# JulienBreux

From Docker:

echo "{{ .USER }}" | docker run -i -e USER=$USER --rm --name clamp julienbreux/clamp:latest
# JulienBreux

How to use from file

Locally:

echo "{{ .HOME }}" > home.txt
clamp home.txt
# /Users/julienbreux

From Docker:

echo "{{ .HOME }}" > home.txt
docker run \
    -i \
    -e HOME=$HOME \
    --rm \
    --name clamp \
    -v $PWD/home.txt:/home.txt \
    julienbreux/clamp:latest \
    home.txt
# /Users/julienbreux

๐Ÿ”ง Installation

Clamp is available on Linux, OSX and Windows platforms.

  • Binaries for Mac OS, Linux and Windows are available as tarballs in the release page.

  • Via Homebrew (Mac OS) or LinuxBrew (Linux)

    brew tap JulienBreux/clamp
    brew install clamp
  • Building from source Clamp was built using go 1.12 or above. In order to build Clamp from source you must:

    1. Clone this repository

    2. Add the following command in your go.mod file

      replace (
        github.com/JulienBreux/clamp => CLONED_GIT_REPOSITORY
      )
      
    3. Build and run the executable

      go run main.go
    4. Use it

      ./clamp

๐Ÿ“ฎ Contact Info

  1. Email: julien.breux@gmail.com
  2. GitHub: @JulienBreux
  3. Twitter: @JulienBreux

๐Ÿ‘ฎโ€โ™‚๏ธ Security info

GPG Signature

You can download Julien Breux's public key to verify the signature.

gpg --keyserver hkps://hkps.pool.sks-keyservers.net --recv-keys 0BD023FA