Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to pipe string #282

Open
fmnxl opened this issue Aug 11, 2024 · 4 comments
Open

Unable to pipe string #282

fmnxl opened this issue Aug 11, 2024 · 4 comments

Comments

@fmnxl
Copy link

fmnxl commented Aug 11, 2024

I've been trying to use the pipe feature (#154), but I got this error.
From my understanding, the piped string should be available as /dev/stdin?
Sorry if this is unrelated to agenix itself.

> echo "XXXXXXXXXXXXXXXXXXX" | agenix -e my-secret.age
cp: skipping file '/dev/stdin', as it was replaced while being copied
my-secret.age wasn't created.

Edit: it might be relevant that I'm running this on macOS

@fmnxl
Copy link
Author

fmnxl commented Aug 11, 2024

Ok this seems like a darwin/macOS issue.

echo "XXXX" | cp /dev/stdin /dev/stdout

This outputs the original string on linux, while on darwin it errors with the above message

@Urie96
Copy link

Urie96 commented Jan 17, 2025

Is there a way to pipe string to agenix on mac? I know echo "XXXX" | cat >/dev/stdout works on mac, but I don't know how to get agenix to use it this way.

@fmnxl
Copy link
Author

fmnxl commented Jan 17, 2025

I ended up using ragenix

@Urie96
Copy link

Urie96 commented Jan 17, 2025

This bash script helps me pass the binary file to agenix without opening an editor.

#!/usr/bin/env bash

src="$(realpath -s "$1")"
filename="${src##*/}"
cd ~/nix/secrets || exit 1
EDITOR="cp $src" agenix -e "$filename.age"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants