chore: доделываем поднятие сервера
This commit is contained in:
1 parent
adab286884
commit
8532557ef6
18 files changed
+749
-37
No files matched your search
@@ -0,0 +1,39 @@
|
||||
from django.db import migrations, models
|
||||
from serverus import generate_password, generate_port
|
||||
|
||||
|
||||
def generate_subscription(apps, schema_editor):
|
||||
# у уже установленных точек подписка появится после переустановки
|
||||
Point = apps.get_model('App', 'Point')
|
||||
for point in Point.objects.all():
|
||||
point.sub_port = generate_port(exclude={point.panel_port})
|
||||
point.sub_path = generate_password(12)
|
||||
point.save(update_fields=['sub_port', 'sub_path'])
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('App', '0003_server_default_root_password'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='point',
|
||||
name='panel_inbound_id',
|
||||
field=models.PositiveIntegerField(blank=True, help_text='Подключение reality в панели', null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='point',
|
||||
name='sub_port',
|
||||
field=models.PositiveIntegerField(default=0, help_text='Порт подписки панели'),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='point',
|
||||
name='sub_path',
|
||||
field=models.CharField(default='', help_text='Путь подписки без слешей', max_length=64),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.RunPython(generate_subscription, migrations.RunPython.noop),
|
||||
]
|
||||
Reference in new issue
Block a user