Merge branch 'main' into feat/proxy-v2
This commit is contained in:
commit
70d71e812e
3 changed files with 21 additions and 1 deletions
|
|
@ -8,4 +8,8 @@ require (
|
|||
github.com/mattn/go-sqlite3 v1.14.28
|
||||
)
|
||||
|
||||
require github.com/felixge/httpsnoop v1.0.3 // indirect
|
||||
require (
|
||||
github.com/felixge/httpsnoop v1.0.3 // indirect
|
||||
github.com/joho/godotenv v1.5.1 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.28 // indirect
|
||||
)
|
||||
|
|
|
|||
|
|
@ -4,5 +4,7 @@ github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyE
|
|||
github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w=
|
||||
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
||||
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
||||
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
||||
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
||||
github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A=
|
||||
github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||
|
|
|
|||
|
|
@ -2,8 +2,11 @@ package config
|
|||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
|
|
@ -31,6 +34,17 @@ type StorageConfig struct {
|
|||
}
|
||||
|
||||
func Load() (*Config, error) {
|
||||
// Load .env file if it exists
|
||||
// Look for .env file in the project root (one level up from proxy/)
|
||||
envPath := filepath.Join("..", ".env")
|
||||
if err := godotenv.Load(envPath); err != nil {
|
||||
// If .env doesn't exist in parent directory, try current directory
|
||||
if err := godotenv.Load(".env"); err != nil {
|
||||
// .env file is optional, so we just log and continue
|
||||
// This allows the app to work with system environment variables only
|
||||
}
|
||||
}
|
||||
|
||||
cfg := &Config{
|
||||
Server: ServerConfig{
|
||||
Port: getEnv("PORT", "3001"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue