Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/julienbreux/clamp
🗜 Clamp — Replace environment variables in any file using go template syntax
https://github.com/julienbreux/clamp
environment-variables go go-template
Last synced: 28 days ago
JSON representation
🗜 Clamp — Replace environment variables in any file using go template syntax
- Host: GitHub
- URL: https://github.com/julienbreux/clamp
- Owner: JulienBreux
- License: mit
- Created: 2020-01-31T16:30:23.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-03-07T02:42:28.000Z (over 1 year ago)
- Last Synced: 2023-12-19T17:11:03.751Z (11 months ago)
- Topics: environment-variables, go, go-template
- Language: Go
- Homepage:
- Size: 5.18 MB
- Stars: 8
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🗜 Clamp — Replace environment variables in any file using go template syntax
[![Actions Status](https://github.com/JulienBreux/clamp/workflows/Build%20and%20test%20Go/badge.svg)](https://github.com/JulienBreux/clamp/actions)
[![Go Report Card](https://goreportcard.com/badge/github.com/JulienBreux/clamp)](https://goreportcard.com/report/github.com/JulienBreux/clamp)
[![codebeat badge](https://codebeat.co/badges/2730cae5-0cf6-43f7-a04d-2163b5902013)](https://codebeat.co/projects/github-com-julienbreux-clamp-main)
[![GitHub tag](https://img.shields.io/github/tag/JulienBreux/clamp.svg)](Tag)
[![Go version](https://img.shields.io/github/go-mod/go-version/JulienBreux/clamp)](https://golang.org/dl/#stable)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:
```bash
echo "{{ .USER }}" | clamp
# JulienBreux
```From Docker:
```bash
echo "{{ .USER }}" | docker run -i -e USER=$USER --rm --name clamp julienbreux/clamp:latest
# JulienBreux
```### How to use from file
Locally:
```bash
echo "{{ .HOME }}" > home.txt
clamp home.txt
# /Users/julienbreux
```From Docker:
```bash
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](https://github.com/JulienBreux/clamp/releases) page.
* Via Homebrew (Mac OS) or LinuxBrew (Linux)
```shell
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```text
replace (
github.com/JulienBreux/clamp => CLONED_GIT_REPOSITORY
)
```3. Build and run the executable
```shell
go run main.go
```4. Use it
```shell
./clamp
```---
## 📮 Contact Info
1. **Email**: [email protected]
2. **GitHub**: [@JulienBreux](https://github.com/JulienBreux)
3. **Twitter**: [@JulienBreux](https://twitter.com/JulienBreux)---
## 👮♂️ Security info
### GPG Signature
You can download Julien Breux's public key to verify the signature.
```shell
gpg --keyserver hkps://hkps.pool.sks-keyservers.net --recv-keys 0BD023FA
```