From 48c1ef8d774c1d06afae0353f118a7bfcc9c010f Mon Sep 17 00:00:00 2001 From: Joaquin Date: Mon, 9 Oct 2023 13:04:09 -0500 Subject: [PATCH] Add migrations. Add env var. --- .../migrations/0033_auto_20230814_2238.py | 36 +++++++++++++++++ .../core/migrations/0034_proxy_provider.py | 40 +++++++++++++++++++ estela-web/.env.development.example | 1 + estela-web/src/constants.ts | 4 +- 4 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 estela-api/core/migrations/0033_auto_20230814_2238.py create mode 100644 estela-api/core/migrations/0034_proxy_provider.py diff --git a/estela-api/core/migrations/0033_auto_20230814_2238.py b/estela-api/core/migrations/0033_auto_20230814_2238.py new file mode 100644 index 00000000..bcb47b11 --- /dev/null +++ b/estela-api/core/migrations/0033_auto_20230814_2238.py @@ -0,0 +1,36 @@ +# Generated by Django 3.1.14 on 2023-08-14 22:38 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("core", "0032_project_framework"), + ] + + operations = [ + migrations.AddField( + model_name="spiderjobenvvar", + name="project", + field=models.ForeignKey( + help_text="Project pid.", + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="env_vars", + to="core.project", + ), + ), + migrations.AddField( + model_name="spiderjobenvvar", + name="spider", + field=models.ForeignKey( + help_text="Spider sid.", + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="env_vars", + to="core.spider", + ), + ), + ] + diff --git a/estela-api/core/migrations/0034_proxy_provider.py b/estela-api/core/migrations/0034_proxy_provider.py new file mode 100644 index 00000000..dbd748f3 --- /dev/null +++ b/estela-api/core/migrations/0034_proxy_provider.py @@ -0,0 +1,40 @@ +# Generated by Django 3.1.14 on 2023-10-09 17:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0033_auto_20230814_2238'), + ] + + operations = [ + migrations.CreateModel( + name='ProxyProvider', + fields=[ + ('proxyid', models.AutoField(help_text='A unique integer value identifying this proxy.', primary_key=True, serialize=False)), + ('username', models.CharField(help_text='The username for the proxy', max_length=255)), + ('password', models.CharField(help_text='The password for the proxy', max_length=255)), + ('host', models.CharField(help_text='The host for the proxy', max_length=255)), + ('port', models.CharField(help_text='The port for the proxy', max_length=5)), + ('name', models.CharField(help_text='A name to identify the proxy', max_length=255)), + ('description', models.CharField(help_text='A description for the proxy', max_length=1000)), + ], + ), + migrations.AddField( + model_name='spiderjob', + name='proxy_usage_data', + field=models.JSONField(default=dict, help_text='Proxy Usage data.'), + ), + migrations.AddField( + model_name='usagerecord', + name='datacenter_proxy_usage', + field=models.PositiveBigIntegerField(default=0, help_text='Amount in bytes occupied by datacenter proxy responses in the database'), + ), + migrations.AddField( + model_name='usagerecord', + name='residential_proxy_usage', + field=models.PositiveBigIntegerField(default=0, help_text='Amount in bytes occupied by residential proxy responses in the database'), + ), + ] diff --git a/estela-web/.env.development.example b/estela-web/.env.development.example index cb84f3f0..db0fa323 100644 --- a/estela-web/.env.development.example +++ b/estela-web/.env.development.example @@ -1,2 +1,3 @@ REACT_APP_API_BASE_URL=http://localhost:8000 REGISTER_PAGE_ENABLED=true +ESTELA_PROXIES="Estela Proxy" diff --git a/estela-web/src/constants.ts b/estela-web/src/constants.ts index 0671c06e..8920b6a7 100644 --- a/estela-web/src/constants.ts +++ b/estela-web/src/constants.ts @@ -1,3 +1,3 @@ export const API_BASE_URL = process.env.REACT_APP_API_BASE_URL; -export const ESTELA_PROXIES = process.env.ESTELA_PROXIES; -export const REGISTER_PAGE_ENABLED = process.env.REGISTER_PAGE_ENABLED === "true"; \ No newline at end of file +export const ESTELA_PROXIES = process.env.ESTELA_PROXIES ? process.env.ESTELA_PROXIES : "Estela Proxy"; +export const REGISTER_PAGE_ENABLED = process.env.REGISTER_PAGE_ENABLED === "true";