Add /config trial VPN generation for users (1 day default)
Users get Remnawave subscription via /config or inline button; TRIAL_USER_DAYS and panel lookup by Telegram ID. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -21,6 +21,7 @@ type Config struct {
|
||||
RemnawaveSubscription string
|
||||
DatabaseURL string
|
||||
DefaultUserDays int
|
||||
TrialUserDays int
|
||||
DefaultExternalSquadUUID string
|
||||
DefaultInternalSquadUUIDs []string
|
||||
}
|
||||
@@ -69,13 +70,20 @@ func Load() (*Config, error) {
|
||||
return nil, fmt.Errorf("DATABASE_URL не задан")
|
||||
}
|
||||
|
||||
days := 30
|
||||
days := 1
|
||||
if v := strings.TrimSpace(os.Getenv("DEFAULT_USER_DAYS")); v != "" {
|
||||
if d, err := strconv.Atoi(v); err == nil && d > 0 {
|
||||
days = d
|
||||
}
|
||||
}
|
||||
|
||||
trialDays := days
|
||||
if v := strings.TrimSpace(os.Getenv("TRIAL_USER_DAYS")); v != "" {
|
||||
if d, err := strconv.Atoi(v); err == nil && d > 0 {
|
||||
trialDays = d
|
||||
}
|
||||
}
|
||||
|
||||
var internalSquads []string
|
||||
if v := strings.TrimSpace(os.Getenv("DEFAULT_INTERNAL_SQUAD_UUIDS")); v != "" {
|
||||
for _, part := range strings.Split(v, ",") {
|
||||
@@ -97,6 +105,7 @@ func Load() (*Config, error) {
|
||||
RemnawaveSubscription: subURL,
|
||||
DatabaseURL: dbURL,
|
||||
DefaultUserDays: days,
|
||||
TrialUserDays: trialDays,
|
||||
DefaultExternalSquadUUID: strings.TrimSpace(os.Getenv("DEFAULT_EXTERNAL_SQUAD_UUID")),
|
||||
DefaultInternalSquadUUIDs: internalSquads,
|
||||
}, nil
|
||||
|
||||
Reference in New Issue
Block a user