26 lines
		
	
	
		
			611 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			611 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package config
 | |
| 
 | |
| import (
 | |
| 	"os"
 | |
| )
 | |
| 
 | |
| type Config struct {
 | |
| 	DSN        string
 | |
| 	Driver     string // "mysql" or "sqlite"
 | |
| 	JWTSecret  string
 | |
| 	Port       string
 | |
| 	LlamaURL   string 
 | |
| }
 | |
| 
 | |
| func getenv(k, def string) string { v := os.Getenv(k); if v == "" { return def }; return v }
 | |
| 
 | |
| func Load() Config {
 | |
|     return Config{
 | |
|         DSN:       getenv("DB_DSN", "file:mind.db?_pragma=busy_timeout(5000)"),
 | |
|         Driver:    getenv("DB_DRIVER", "sqlite"),
 | |
|         JWTSecret: getenv("JWT_SECRET", "devsecret"),
 | |
|         Port:      getenv("PORT", "8080"),
 | |
|         LlamaURL:  getenv("LLAMA_URL", "http://localhost:8081"),
 | |
|     }
 | |
| }
 |