Files
proxy-platform/.env.example
T

35 lines
1.1 KiB
Bash

# 数据库初始化脚本
-- 创建数据库
CREATE DATABASE IF NOT EXISTS proxy_platform;
-- 使用数据库
\c proxy_platform;
-- 创建扩展
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- 插入默认管理员用户(密码: admin123,实际使用 bcrypt 加密)
INSERT INTO users (username, password_hash, traffic_quota, status, created_at, updated_at)
VALUES (
'admin',
'$2a$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy',
107374182400, -- 100GB
'active',
NOW(),
NOW()
) ON CONFLICT (username) DO NOTHING;
-- 插入默认节点组
INSERT INTO node_groups (name, description, created_at, updated_at)
VALUES ('default', '默认节点组', NOW(), NOW())
ON CONFLICT DO NOTHING;
-- 插入默认 IP 刷新规则
INSERT INTO ip_refresh_rules (trigger_type, trigger_value, cooldown, enabled, created_at, updated_at)
VALUES
('unlock_failure', '{"service": "gpt"}', 300, true, NOW(), NOW()),
('unlock_failure', '{"service": "netflix"}', 300, true, NOW(), NOW()),
('usage_count', '{"count": 10000}', 300, true, NOW(), NOW()),
('scheduled', '{"interval": "24h"}', 300, true, NOW(), NOW())
ON CONFLICT DO NOTHING;