modified: begushiybashkir/bbvue/src/components/AvatarUpload.vue
modified: begushiybashkir/bbvue/src/stores/auth.js modified: serv_nginx/api_bb/.env modified: serv_nginx/api_bb/internal/config/config.go modified: serv_nginx/api_bb/internal/models/user.go modified: serv_nginx/api_bb/internal/routes/routes.go modified: serv_nginx/nginx/nginx-ssl.conf some for get photo from api_bb
This commit is contained in:
@@ -12,16 +12,17 @@ type Config struct {
|
||||
Port string
|
||||
DatabaseURL string
|
||||
JWTSecret string
|
||||
StaticURL string `env:"STATIC_URL" envDefault:"http://localhost:8080"`
|
||||
}
|
||||
|
||||
func Load() *Config {
|
||||
_ = godotenv.Load(".env")
|
||||
port := getEnv("PORT", "8080")
|
||||
jwtSecret := getEnv("JWT_SECRET", "your-secret-key")
|
||||
|
||||
|
||||
// Формируем DSN для PostgreSQL из переменных окружения
|
||||
databaseURL := getPostgresDSN()
|
||||
|
||||
|
||||
return &Config{
|
||||
Port: port,
|
||||
DatabaseURL: databaseURL,
|
||||
@@ -47,4 +48,4 @@ func getEnv(key, defaultValue string) string {
|
||||
return defaultValue
|
||||
}
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ type UserUpdate struct {
|
||||
ID uint `json:"id"`
|
||||
FirstName string `json:"first_name"`
|
||||
LastName string `json:"last_name"`
|
||||
Avatar string `json:"avatar"` // Добавить поле аватара
|
||||
Avatar string `json:"avatar"`
|
||||
Phone string `json:"phone"`
|
||||
Experience string `json:"experience"`
|
||||
Goals string `json:"goals"`
|
||||
|
||||
@@ -23,6 +23,10 @@ func SetupRouter(db *gorm.DB, config *config.Config) http.Handler {
|
||||
r.Use(m)
|
||||
}
|
||||
|
||||
// Serve static files (avatars) - ДОБАВЬТЕ ЭТО
|
||||
r.Handle("/uploads/*", http.StripPrefix("/uploads/",
|
||||
http.FileServer(http.Dir("/app/uploads"))))
|
||||
|
||||
// Initialize repositories
|
||||
userRepo := repository.NewUserRepository(db)
|
||||
newsRepo := repository.NewNewsRepository(db)
|
||||
|
||||
Reference in New Issue
Block a user