-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(integrations): add support for Amplitude base url (#2534)
- Loading branch information
1 parent
35a4f06
commit 5d52564
Showing
6 changed files
with
54 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DEFAULT_AMPLITUDE_API_URL = "https://api2.amplitude.com" |
34 changes: 34 additions & 0 deletions
34
api/integrations/amplitude/migrations/0006_add_default_base_url.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Generated by Django 3.2.20 on 2023-07-27 13:04 | ||
|
||
from django.db import migrations, models | ||
from django.db.models import Q | ||
|
||
|
||
def add_default_base_url(apps, schema_editor): | ||
amplitude_configuration_model = apps.get_model( | ||
"amplitude", "AmplitudeConfiguration" | ||
) | ||
|
||
# Note that we're updating the existing items to point to | ||
# api.amplitude.com (rather than api2) to maintain existing | ||
# behaviour for these integrations. | ||
amplitude_configuration_model.objects.filter( | ||
Q(base_url__isnull=True) | Q(base_url="") | ||
).update(base_url="https://api.amplitude.com") | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("amplitude", "0005_amplitudeconfiguration_deleted_at"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
add_default_base_url, reverse_code=migrations.RunPython.noop | ||
), | ||
migrations.AlterField( | ||
model_name="amplitudeconfiguration", | ||
name="base_url", | ||
field=models.URLField(default="https://api2.amplitude.com"), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
from django.db import models | ||
|
||
from environments.models import Environment | ||
from integrations.amplitude.constants import DEFAULT_AMPLITUDE_API_URL | ||
from integrations.common.models import EnvironmentIntegrationModel | ||
|
||
|
||
class AmplitudeConfiguration(EnvironmentIntegrationModel): | ||
base_url = models.URLField(default=DEFAULT_AMPLITUDE_API_URL) | ||
environment = models.OneToOneField( | ||
Environment, related_name="amplitude_config", on_delete=models.CASCADE | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5d52564
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
docs – ./docs
docs-flagsmith.vercel.app
docs.flagsmith.com
docs.bullet-train.io
docs-git-main-flagsmith.vercel.app
5d52564
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
flagsmith-frontend-preview – ./frontend
flagsmith-frontend-preview-git-main-flagsmith.vercel.app
flagsmith-frontend-preview-flagsmith.vercel.app
flagsmith-frontend-production-native.vercel.app
5d52564
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
flagsmith-frontend-staging – ./frontend
flagsmith-staging-frontend.vercel.app
flagsmith-frontend-staging-flagsmith.vercel.app
flagsmith-frontend-staging-git-main-flagsmith.vercel.app
staging.flagsmith.com