Remove completed TODO remark. Optionally support .env files.
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Build Docker image / build (push) Successful in 1m4s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Build Docker image / build (push) Successful in 1m4s
				
			This commit is contained in:
		
							parent
							
								
									2a92510c32
								
							
						
					
					
						commit
						703310f305
					
				
					 2 changed files with 6 additions and 7 deletions
				
			
		
							
								
								
									
										2
									
								
								go.mod
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -9,7 +9,7 @@ require (
 | 
			
		|||
 | 
			
		||||
require (
 | 
			
		||||
	github.com/gorilla/websocket v1.5.0 // indirect
 | 
			
		||||
	github.com/joho/godotenv v1.5.1 // indirect
 | 
			
		||||
	github.com/joho/godotenv v1.5.1
 | 
			
		||||
	golang.org/x/net v0.8.0 // indirect
 | 
			
		||||
	golang.org/x/sync v0.1.0 // indirect
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										11
									
								
								main.go
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								main.go
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,4 +1,3 @@
 | 
			
		|||
// TODO: Optimisation: only log dt1, dt2, rt1, rt2, g on change.
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
| 
						 | 
				
			
			@ -11,6 +10,7 @@ import (
 | 
			
		|||
	_ "time/tzdata"
 | 
			
		||||
 | 
			
		||||
	mqtt "github.com/eclipse/paho.mqtt.golang"
 | 
			
		||||
	"github.com/joho/godotenv"
 | 
			
		||||
	_ "github.com/lib/pq"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -74,11 +74,10 @@ type Payload struct {
 | 
			
		|||
var db *sql.DB
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	// // Load environment variables from .env file if it exists
 | 
			
		||||
	// err := godotenv.Load()
 | 
			
		||||
	// if err != nil {
 | 
			
		||||
	// 	log.Println("Error loading .env file:", err)
 | 
			
		||||
	// }
 | 
			
		||||
	// Load environment variables from .env file if it exists
 | 
			
		||||
	if err := godotenv.Load(); err != nil {
 | 
			
		||||
		log.Println("No .env file found or error loading .env file")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Connect to PostgreSQL
 | 
			
		||||
	pgConnStr := os.Getenv("PG_DB")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue