-
Notifications
You must be signed in to change notification settings - Fork 33
feat: support loading a dotenv '.env' file for your app #436
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
base: main
Are you sure you want to change the base?
Changes from all commits
c438267
fb0cce1
0266d17
72828ec
f63d0ff
4b29a23
2324d5f
9160bcc
7dfc00d
c1382df
525f693
6cadb2d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -181,6 +181,7 @@ func deployHook(ctx context.Context, clients *shared.ClientFactory) error { | |
| // so we instantiate the default here. | ||
| shell := hooks.HookExecutorDefaultProtocol{ | ||
| IO: clients.IO, | ||
| Fs: clients.Fs, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔭 note: Standalone protocol setups must define |
||
| } | ||
| if _, err := shell.Execute(ctx, hookExecOpts); err != nil { | ||
| return err | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,24 +17,10 @@ package config | |
| import ( | ||
| "strings" | ||
|
|
||
| "github.com/joho/godotenv" | ||
| "github.com/slackapi/slack-cli/internal/version" | ||
| "github.com/spf13/afero" | ||
| ) | ||
|
|
||
| // GetDotEnvFileVariables collects only the variables in the .env file | ||
| func (c *Config) GetDotEnvFileVariables() (map[string]string, error) { | ||
| variables := map[string]string{} | ||
| file, err := afero.ReadFile(c.fs, ".env") | ||
| if err != nil && !c.os.IsNotExist(err) { | ||
| return variables, err | ||
| } | ||
| return godotenv.UnmarshalBytes(file) | ||
| } | ||
|
Comment on lines
-25
to
-33
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📦 note: This is moved to our own |
||
|
|
||
| // LoadEnvironmentVariables sets flags based on their environment variable value | ||
| // | ||
| // Note: Values are not loaded from the .env file. Use: `GetDotEnvFileVariables` | ||
| func (c *Config) LoadEnvironmentVariables() error { | ||
| // Skip when dependencies are not configured | ||
| if c.os == nil { | ||
|
|
||
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.
📚 note: This is motivated in ongoing changes with encouragement and optimism for checks from the wonderful
wrapchecklint:🔗 https://golangci-lint.run/docs/linters/configuration/#wrapcheck