// Loading the required environment variables for S3. func init() { err := goenv.Load() if err != nil { log.Fatal("The enviroment variable file (.env) is missing.") os.Exit(1) } }
func init() { // connect to Redis on init, and get highest group ID err := goenv.Load() if err != nil { fmt.Println("Missing environment variables file") panic(err) } rC := RedisConnection() defer rC.Close() groupSeqValue, err := redis.Int(rC.Do("GET", "id:groups")) if err != nil { _, err := rC.Do("SET", "id:groups", 1) // initialize if doesn't exist ErrorHandler(err) groupSeqValue = 1 } gifSeqValue, err := redis.Int(rC.Do("GET", "id:gifs")) if err != nil { _, err := rC.Do("SET", "id:gifs", 1) // initialize if doesn't exist ErrorHandler(err) gifSeqValue = 1 } groupSeq = groupSeqValue gifSeq = gifSeqValue }
func init() { err := goenv.Load() if err != nil { fmt.Println(err) os.Exit(1) } }
func main() { checkErr(goenv.Load()) base := GetBase() r := gin.Default() r.GET("/users", base.listUsers) r.GET("/users/:user_id", base.getUser) r.DELETE("/users/:user_id", base.deleteUser) r.PUT("/users/:user_id", base.editUser) r.POST("/users", base.addUser) r.Run(":8080") }