flyctl icon indicating copy to clipboard operation
flyctl copied to clipboard

flyctl secrets import should allow whitespace between key, value, and =

Open curiousercreative opened this issue 2 years ago • 4 comments

Describe the bug Secrets import still doesn't allow whitespace between key, value, and =.

$ cat /etc/os-release
NAME="Pop!_OS"
VERSION="22.04 LTS"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 22.04 LTS"
VERSION_ID="22.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=jammy
UBUNTU_CODENAME=jammy
LOGO=distributor-logo-pop-os

$ flyctl version
flyctl v0.1.119 linux/amd64 Commit: e2d15d62a963c6a86daeefcfb435788575ba98f1 BuildDate: 2023-11-06T22:46:27Z

Command output:

$ cat .env
APP_ENV = production

$ cat .env | flyctl secrets import
Error: Validation failed: Name only allows letters, numbers, and underscores

Relates to: https://github.com/superfly/flyctl/issues/1710

curiousercreative avatar Nov 08 '23 02:11 curiousercreative

Hey, did you got any workaround for that?

thereis avatar Aug 21 '24 21:08 thereis

@thereis no, I was manually removing whitespace prior to running the command. It shouldn't be hard to strip the whitespace on the fly though.

curiousercreative avatar Aug 26 '24 15:08 curiousercreative

I'm no Go engineer, but maybe someone can add the whitespace stripping here

curiousercreative avatar Aug 26 '24 15:08 curiousercreative

And in the meantime, I think this may do. Removes blank lines first then removes whitespace surrounding =

cat .env | sed -r '/^\s*$/d' | sed -r 's/\s*=\s*/=/g' | flyctl secrets import

curiousercreative avatar Aug 26 '24 15:08 curiousercreative