Skip to content

Commit 0816fd8

Browse files
committed
feat: basic env impl
1 parent dbd599c commit 0816fd8

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

commands/root.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
package commands
22

33
import (
4+
"os"
5+
46
"github.com/barelyhuman/alvu/pkg/alvu"
7+
"github.com/joho/godotenv"
58
"github.com/urfave/cli/v2"
69
)
710

811
func Alvu(c *cli.Context) (err error) {
12+
// Prepare Environment
13+
envFilePath := c.String("env")
14+
if _, err := os.Stat(envFilePath); err == nil {
15+
godotenv.Load(envFilePath)
16+
}
17+
918
baseConfig := alvu.AlvuConfig{}
1019

1120
// Basics

main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ func main() {
6262
Usage: "Define the poll duration in seconds",
6363
Value: 1000,
6464
},
65+
&cli.StringFlag{
66+
Name: "env",
67+
Usage: "Environment File to consider",
68+
Value: ".env",
69+
},
6570
&cli.StringFlag{
6671
Name: "port",
6772
Usage: "port to use for serving the application",

0 commit comments

Comments
 (0)