Compare commits

...

2 Commits

Author SHA1 Message Date
brian e2ae8f41e9 reading from an env file 2026-05-06 21:35:39 -06:00
brian 068625aaad importing godotenv 2026-05-06 21:30:25 -06:00
4 changed files with 27 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
# HTTP Settings
PORT=8080
# App Settings
STORAGE_PATH=files
+2
View File
@@ -1,3 +1,5 @@
module drogobox.com/drogobox module drogobox.com/drogobox
go 1.25.9 go 1.25.9
require github.com/joho/godotenv v1.5.1 // indirect
+2
View File
@@ -0,0 +1,2 @@
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
+18 -2
View File
@@ -1,7 +1,23 @@
package main package main
import "fmt" import (
"fmt"
"log"
"os"
"github.com/joho/godotenv"
)
func main() { func main() {
fmt.Println("Greetings Program") err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
port := os.Getenv("PORT")
storage_path := os.Getenv("STORAGE_PATH")
fmt.Printf("in the future I will listen on port: %s\n", port)
fmt.Printf("Reading files from: %s\n", storage_path)
} }