update envs and urls
This commit is contained in:
@@ -6,6 +6,9 @@ POSTGRES_DB=delivery_tracker
|
|||||||
# JWT
|
# JWT
|
||||||
JWT_SECRET=your_random_jwt_secret_min_32_chars
|
JWT_SECRET=your_random_jwt_secret_min_32_chars
|
||||||
|
|
||||||
|
# Seed admin password
|
||||||
|
SEED_ADMIN_PASSWORD=your_secure_password_here
|
||||||
|
|
||||||
# Gitea Registry credentials for Watchtower
|
# Gitea Registry credentials for Watchtower
|
||||||
GITEA_REGISTRY=gitea.your-domain.com/yourusername
|
GITEA_REGISTRY=gitea.your-domain.com/yourusername
|
||||||
GITEA_USER=your_gitea_username
|
GITEA_USER=your_gitea_username
|
||||||
|
|||||||
@@ -24,21 +24,18 @@ func main() {
|
|||||||
|
|
||||||
queries := db.New(pool)
|
queries := db.New(pool)
|
||||||
|
|
||||||
// Проверяем, есть ли уже пользователи
|
|
||||||
_, err = queries.GetUserByUsername(ctx, "admin")
|
_, err = queries.GetUserByUsername(ctx, "admin")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
log.Println("admin user already exists, skipping seed")
|
log.Println("admin user already exists, skipping seed")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Создаём через auth service (правильное хеширование)
|
|
||||||
secret := []byte(os.Getenv("JWT_SECRET"))
|
secret := []byte(os.Getenv("JWT_SECRET"))
|
||||||
if len(secret) == 0 {
|
if len(secret) == 0 {
|
||||||
log.Fatalf("JWT_SECRET not set")
|
log.Fatalf("JWT_SECRET not set")
|
||||||
}
|
}
|
||||||
authService := auth.New(queries, secret, 0)
|
authService := auth.New(queries, secret, 0)
|
||||||
|
|
||||||
// Пароль из env или дефолтный (только для разработки!)
|
|
||||||
password := os.Getenv("SEED_ADMIN_PASSWORD")
|
password := os.Getenv("SEED_ADMIN_PASSWORD")
|
||||||
if password == "" {
|
if password == "" {
|
||||||
password = "admin123" // ⚠️ только для dev!
|
password = "admin123" // ⚠️ только для dev!
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# API Configuration
|
# API Configuration
|
||||||
# Leave empty to use proxy (recommended for local dev and production)
|
# Leave empty to use proxy (recommended for local dev and production)
|
||||||
# Or set full URL like http://localhost:8081 for direct API access
|
# Or set full URL like http://localhost:8081 for direct API access
|
||||||
VITE_API_URL=
|
VITE_API_URL=http://localhost:8080
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export default defineConfig({
|
|||||||
allowedHosts: ['delivery.loca.lt', '.loca.lt'],
|
allowedHosts: ['delivery.loca.lt', '.loca.lt'],
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://localhost:8081',
|
target: 'http://localhost:8080',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user