-
Notifications
You must be signed in to change notification settings - Fork 397
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
support embed command in dotenv file #55
Conversation
IMO it would be best if this were an opt-in feature, since this can open up all kinds of security risks! |
Agreed. |
So how about I do it this way: godotenv.EnableEmbed()
godotenv.Load() If we don't |
if strings.HasPrefix(value, "$(") && strings.HasSuffix(value, ")") { | ||
cmdStr := value[2 : len(value)-1] | ||
cmd := exec.Command("/bin/sh", "-c", cmdStr) | ||
out, _ := cmd.Output() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why silence the error here? Wouldn't that make it harder to diagnose failures?
if shouldParseEmbed { | ||
if strings.HasPrefix(value, "$(") && strings.HasSuffix(value, ")") { | ||
cmdStr := value[2 : len(value)-1] | ||
cmd := exec.Command("/bin/sh", "-c", cmdStr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you do a check for the OS here and if on Windows create a PowerShell session?
@durandj @DarthPestilane seeing as it looks like this went stale, I've addressed the comments / concerns and opened a new PR #230 |
Closing per #182 but thank you |
Support embed commands via
$()
(not supported on Windows)Note that using $() might not work depending on your shell.