Add API validation when creating ReceptorAddress

- websocket_path can only be set if protocol is ws
- is_internal must be False
- only 1 address per instance can have
peers_from_control_nodes set to True

Signed-off-by: Seth Foster <fosterbseth@gmail.com>
This commit is contained in:
Seth Foster
2023-11-09 14:12:45 -05:00
committed by Seth Foster
parent d860d1d91b
commit 7d7503279d
3 changed files with 43 additions and 24 deletions

View File

@@ -1,5 +1,6 @@
# Generated by Django 4.2.6 on 2023-11-02 18:07
# Generated by Django 4.2.6 on 2023-11-09 19:11
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
@@ -15,7 +16,12 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('address', models.CharField(max_length=255)),
('port', models.IntegerField(default=27199)),
(
'port',
models.IntegerField(
default=27199, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(65535)]
),
),
('protocol', models.CharField(default='tcp', max_length=10)),
('websocket_path', models.CharField(blank=True, default='', max_length=255)),
('is_internal', models.BooleanField(default=False)),