-
Notifications
You must be signed in to change notification settings - Fork 113
This PR includes combined multiple features till now #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,57 +2,105 @@ package main | |||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| import ( | ||||||||||||||||||||||||||||||||
| "log" | ||||||||||||||||||||||||||||||||
| "os" | ||||||||||||||||||||||||||||||||
| "strconv" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| "arguehub/config" | ||||||||||||||||||||||||||||||||
| "arguehub/db" | ||||||||||||||||||||||||||||||||
| "arguehub/middlewares" | ||||||||||||||||||||||||||||||||
| "arguehub/routes" | ||||||||||||||||||||||||||||||||
| "arguehub/services" | ||||||||||||||||||||||||||||||||
| "arguehub/utils" | ||||||||||||||||||||||||||||||||
| "arguehub/websocket" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| "github.com/gin-contrib/cors" | ||||||||||||||||||||||||||||||||
| "github.com/gin-gonic/gin" | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| func main() { | ||||||||||||||||||||||||||||||||
| // Load the configuration from the specified YAML file | ||||||||||||||||||||||||||||||||
| cfg, err := config.LoadConfig("./config/config.prod.yml") | ||||||||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||||||||
| log.Fatalf("Failed to load config: %v", err) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| router := setupRouter(cfg) | ||||||||||||||||||||||||||||||||
| services.InitDebateVsBotService(cfg) | ||||||||||||||||||||||||||||||||
| services.InitCoachService() | ||||||||||||||||||||||||||||||||
| // Connect to MongoDB using the URI from the configuration | ||||||||||||||||||||||||||||||||
| if err := db.ConnectMongoDB(cfg.Database.URI); err != nil { | ||||||||||||||||||||||||||||||||
| log.Fatalf("Failed to connect to MongoDB: %v", err) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| log.Println("Connected to MongoDB") | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Seed initial debate-related data | ||||||||||||||||||||||||||||||||
| utils.SeedDebateData() | ||||||||||||||||||||||||||||||||
| utils.PopulateTestUsers() | ||||||||||||||||||||||||||||||||
|
Comment on lines
+36
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π‘ Verification agent π§© Analysis chainEnsure data seeding is idempotent to prevent duplicates. The π Script executed: #!/bin/bash
# Description: Examine the seed functions to verify idempotency
# Check SeedDebateData implementation
echo "=== Checking SeedDebateData ==="
ast-grep --pattern 'func SeedDebateData() {
$$$
}'
# Check PopulateTestUsers implementation
echo -e "\n=== Checking PopulateTestUsers ==="
ast-grep --pattern 'func PopulateTestUsers() {
$$$
}'Length of output: 4848 Add idempotency guard to PopulateTestUsers While SeedDebateData already skips seeding when the debates collection is non-empty, PopulateTestUsers unconditionally inserts the same users on every server startβleading to duplicates. β’ File: backend/utils/user.go Suggested fix (before looping inserts): // Skip if users collection already has data
count, err := collection.CountDocuments(context.Background(), bson.M{})
if err != nil || count > 0 {
return
}Then proceed with defining and inserting π€ Prompt for AI Agents |
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Create uploads directory | ||||||||||||||||||||||||||||||||
| os.MkdirAll("uploads", os.ModePerm) | ||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add error handling for directory creation. The error from Apply this diff to add error handling: - os.MkdirAll("uploads", os.ModePerm)
+ if err := os.MkdirAll("uploads", os.ModePerm); err != nil {
+ log.Fatalf("Failed to create uploads directory: %v", err)
+ }π€ Prompt for AI Agents |
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Set up the Gin router and configure routes | ||||||||||||||||||||||||||||||||
| router := setupRouter(cfg) | ||||||||||||||||||||||||||||||||
| port := strconv.Itoa(cfg.Server.Port) | ||||||||||||||||||||||||||||||||
| log.Printf("Server starting on port %s", port) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| if err := router.Run(":" + port); err != nil { | ||||||||||||||||||||||||||||||||
| log.Fatalf("Failed to start server: %v", err) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| func setupRouter(cfg *config.Config) *gin.Engine { | ||||||||||||||||||||||||||||||||
| // gin.SetMode(gin.ReleaseMode) // Uncomment this line for production | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| router := gin.Default() | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Set trusted proxies (adjust as needed) | ||||||||||||||||||||||||||||||||
| router.SetTrustedProxies([]string{"127.0.0.1", "localhost"}) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Configure CORS for your frontend (e.g., localhost:5173 for Vite) | ||||||||||||||||||||||||||||||||
| router.Use(cors.New(cors.Config{ | ||||||||||||||||||||||||||||||||
| AllowOrigins: []string{"http://localhost:5173"}, | ||||||||||||||||||||||||||||||||
| AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"}, | ||||||||||||||||||||||||||||||||
| AllowHeaders: []string{"Origin", "Content-Type", "Authorization"}, | ||||||||||||||||||||||||||||||||
| ExposeHeaders: []string{"Content-Length"}, | ||||||||||||||||||||||||||||||||
| AllowCredentials: true, | ||||||||||||||||||||||||||||||||
| })) | ||||||||||||||||||||||||||||||||
|
Comment on lines
59
to
65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion Make CORS origins configurable for different environments. The CORS configuration has a hardcoded origin Consider loading allowed origins from the configuration: router.Use(cors.New(cors.Config{
- AllowOrigins: []string{"http://localhost:5173"},
+ AllowOrigins: cfg.CORS.AllowedOrigins,
AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
AllowHeaders: []string{"Origin", "Content-Type", "Authorization"},
ExposeHeaders: []string{"Content-Length"},
AllowCredentials: true,
}))π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| router.OPTIONS("/*path", func(c *gin.Context) { c.Status(204) }) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| router.OPTIONS("/*path", func(c *gin.Context) { | ||||||||||||||||||||||||||||||||
| c.Status(204) | ||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Public routes for authentication | ||||||||||||||||||||||||||||||||
| router.POST("/signup", routes.SignUpRouteHandler) | ||||||||||||||||||||||||||||||||
| router.POST("/verifyEmail", routes.VerifyEmailRouteHandler) | ||||||||||||||||||||||||||||||||
| router.POST("/login", routes.LoginRouteHandler) | ||||||||||||||||||||||||||||||||
| router.POST("/googleLogin", routes.GoogleLoginRouteHandler) | ||||||||||||||||||||||||||||||||
| router.POST("/forgotPassword", routes.ForgotPasswordRouteHandler) | ||||||||||||||||||||||||||||||||
| router.POST("/confirmForgotPassword", routes.VerifyForgotPasswordRouteHandler) | ||||||||||||||||||||||||||||||||
| router.POST("/verifyToken", routes.VerifyTokenRouteHandler) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| router.GET("/ws", websocket.WebsocketHandler) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Protected routes (JWT auth) | ||||||||||||||||||||||||||||||||
| auth := router.Group("/") | ||||||||||||||||||||||||||||||||
| auth.Use(middlewares.AuthMiddleware("./config/config.prod.yml")) | ||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potential issue with hardcoded config path in middleware. The auth middleware is initialized with the same hardcoded config path that might not exist. Consider passing the already loaded config object instead: - auth.Use(middlewares.AuthMiddleware("./config/config.prod.yml"))
+ auth.Use(middlewares.AuthMiddleware(cfg))This requires updating the AuthMiddleware function signature to accept a config object instead of a file path. π€ Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| auth.GET("/user/fetchprofile", routes.GetProfileRouteHandler) | ||||||||||||||||||||||||||||||||
| auth.PUT("/user/updateprofile", routes.UpdateProfileRouteHandler) | ||||||||||||||||||||||||||||||||
| auth.GET("/leaderboard", routes.GetLeaderboardRouteHandler) | ||||||||||||||||||||||||||||||||
| auth.POST("/debate/result", routes.UpdateEloAfterDebateRouteHandler) | ||||||||||||||||||||||||||||||||
| routes.SetupDebateVsBotRoutes(auth) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // WebSocket signaling endpoint | ||||||||||||||||||||||||||||||||
| auth.GET("/ws", websocket.WebsocketHandler) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| routes.SetupTranscriptRoutes(auth) | ||||||||||||||||||||||||||||||||
| auth.GET("/coach/strengthen-argument/weak-statement", routes.GetWeakStatement) | ||||||||||||||||||||||||||||||||
| auth.POST("/coach/strengthen-argument/evaluate", routes.EvaluateStrengthenedArgument) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Add Room routes. | ||||||||||||||||||||||||||||||||
| auth.GET("/rooms", routes.GetRoomsHandler) | ||||||||||||||||||||||||||||||||
| auth.POST("/rooms", routes.CreateRoomHandler) | ||||||||||||||||||||||||||||||||
| auth.POST("/rooms/:id/join", routes.JoinRoomHandler) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| auth.GET("/chat/:roomId", websocket.RoomChatHandler) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| auth.GET("/coach/pros-cons/topic", routes.GetProsConsTopic) | ||||||||||||||||||||||||||||||||
| auth.POST("/coach/pros-cons/submit", routes.SubmitProsCons) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| return router | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,37 +2,63 @@ package config | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "fmt" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "io/ioutil" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "io/ioutil" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace deprecated The - "io/ioutil"
+ "os"And update the LoadConfig function: - data, err := ioutil.ReadFile(path)
+ data, err := os.ReadFile(path)π Committable suggestion
Suggested change
π§° Toolsπͺ golangci-lint (1.64.8)5-5: SA1019: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package [io] or package [os], and those implementations should be preferred in new code. See the specific function documentation for details. (staticcheck) π€ Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "gopkg.in/yaml.v3" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "gopkg.in/yaml.v3" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type Config struct { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Server struct { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Port int `yaml:"port"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } `yaml:"server"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Cognito struct { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AppClientId string `yaml:"appClientId"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AppClientSecret string `yaml:"appClientSecret"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| UserPoolId string `yaml:"userPoolId"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Region string `yaml:"region"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } `yaml:"cognito"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Openai struct { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GptApiKey string `yaml:"gptApiKey"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } `yaml:"openai` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Server struct { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Port int `yaml:"port"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } `yaml:"server"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Cognito struct { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AppClientId string `yaml:"appClientId"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AppClientSecret string `yaml:"appClientSecret"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| UserPoolId string `yaml:"userPoolId"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Region string `yaml:"region"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } `yaml:"cognito"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Openai struct { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GptApiKey string `yaml:"gptApiKey"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } `yaml:"openai"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Gemini struct { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ApiKey string `yaml:"apiKey"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } `yaml:"gemini"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Database struct { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| URI string `yaml:"uri"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } `yaml:"database"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| JWT struct { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Secret string // Add JWT secret | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Expiry int // Token expiry in minutes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SMTP struct { // Add SMTP configuration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Host string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Port int | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Username string // Gmail address | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Password string // App Password | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SenderEmail string // Same as Username for Gmail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SenderName string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GoogleOAuth struct { // Add Google OAuth configuration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ClientID string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+34
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add missing YAML tags to configuration structs. The JWT struct {
- Secret string // Add JWT secret
- Expiry int // Token expiry in minutes
-}
+ Secret string `yaml:"secret"` // Add JWT secret
+ Expiry int `yaml:"expiry"` // Token expiry in minutes
+} `yaml:"jwt"`
SMTP struct { // Add SMTP configuration
- Host string
- Port int
- Username string // Gmail address
- Password string // App Password
- SenderEmail string // Same as Username for Gmail
- SenderName string
-}
+ Host string `yaml:"host"`
+ Port int `yaml:"port"`
+ Username string `yaml:"username"` // Gmail address
+ Password string `yaml:"password"` // App Password
+ SenderEmail string `yaml:"senderEmail"` // Same as Username for Gmail
+ SenderName string `yaml:"senderName"`
+} `yaml:"smtp"`
GoogleOAuth struct { // Add Google OAuth configuration
- ClientID string
-}
+ ClientID string `yaml:"clientId"`
+} `yaml:"googleOAuth"`π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // LoadConfig reads the configuration file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func LoadConfig(path string) (*Config, error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| data, err := ioutil.ReadFile(path) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return nil, fmt.Errorf("failed to read config file: %w", err) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| data, err := ioutil.ReadFile(path) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return nil, fmt.Errorf("failed to read config file: %w", err) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var cfg Config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if err := yaml.Unmarshal(data, &cfg); err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return nil, fmt.Errorf("failed to unmarshal yaml: %w", err) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var cfg Config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if err := yaml.Unmarshal(data, &cfg); err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return nil, fmt.Errorf("failed to unmarshal yaml: %w", err) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return &cfg, nil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return &cfg, nil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π‘ Verification agent
π§© Analysis chain
Verify that the configuration file exists at the specified path.
The code attempts to load
./config/config.prod.yml, but according to the AI summary, the production version of this file was removed. This could cause a runtime failure.π Script executed:
Length of output: 271
Missing production config file and hardcoded path
The code calls:
but there is no
config/directory orconfig.prod.ymlfile in the repo. This will cause a runtime failure and offers no flexibility for other environments.Please:
config.LoadConfigto default to a sane fallback or fail with a clear error message.π€ Prompt for AI Agents