mirror of
				https://github.com/yanislav-igonin/micrach
				synced 2025-11-04 02:27:02 +03:00 
			
		
		
		
	feat: hide seeds under env var
This commit is contained in:
		
							parent
							
								
									d456be5e9a
								
							
						
					
					
						commit
						ac006d5f1b
					
				@ -1,3 +1,4 @@
 | 
			
		||||
ENV=debug
 | 
			
		||||
PORT=3000
 | 
			
		||||
SEED_DB=true
 | 
			
		||||
POSTGRES_URL=postgres://localhost/micrach
 | 
			
		||||
@ -7,8 +7,9 @@ import (
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type AppConfig struct {
 | 
			
		||||
	Env  string
 | 
			
		||||
	Port int
 | 
			
		||||
	Env    string
 | 
			
		||||
	Port   int
 | 
			
		||||
	SeedDb bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type DbConfig struct {
 | 
			
		||||
@ -30,9 +31,13 @@ func getAppConfig() AppConfig {
 | 
			
		||||
		panic(fmt.Sprintf("Could not parse %s to int", portString))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	seedDbString := os.Getenv("SEED_DB")
 | 
			
		||||
	seedDb := seedDbString == "true"
 | 
			
		||||
 | 
			
		||||
	return AppConfig{
 | 
			
		||||
		Env:  env,
 | 
			
		||||
		Port: port,
 | 
			
		||||
		Env:    env,
 | 
			
		||||
		Port:   port,
 | 
			
		||||
		SeedDb: seedDb,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user