Skip to content

Commit

Permalink
Removed unused configuration class (#6682)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Chubatiuk <andrew.chubatiuk@motional.com>
  • Loading branch information
AndrewChubatiuk and Andrew Chubatiuk authored Jan 18, 2024
1 parent 30e7392 commit 97db492
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from redash.utils.configuration import ConfigurationContainer
from redash.models.types import (
EncryptedConfiguration,
Configuration,
MutableDict,
MutableList,
)
Expand Down Expand Up @@ -45,7 +44,14 @@ def upgrade():
)
),
),
sa.Column("options", ConfigurationContainer.as_mutable(Configuration)),
sa.Column(
"options",
ConfigurationContainer.as_mutable(
EncryptedConfiguration(
sa.Text, settings.DATASOURCE_SECRET_KEY, FernetEngine
)
),
),
)

conn = op.get_bind()
Expand Down
14 changes: 9 additions & 5 deletions migrations/versions/d7d747033183_encrypt_alert_destinations.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
from redash import settings
from redash.utils.configuration import ConfigurationContainer
from redash.models.base import key_type
from redash.models.types import (
EncryptedConfiguration,
Configuration,
)
from redash.models.types import EncryptedConfiguration


# revision identifiers, used by Alembic.
Expand Down Expand Up @@ -45,7 +42,14 @@ def upgrade():
)
),
),
sa.Column("options", ConfigurationContainer.as_mutable(Configuration)),
sa.Column(
"options",
ConfigurationContainer.as_mutable(
EncryptedConfiguration(
sa.Text, settings.DATASOURCE_SECRET_KEY, FernetEngine
)
),
),
)

conn = op.get_bind()
Expand Down
1 change: 0 additions & 1 deletion redash/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
QueryDetachedFromDataSourceError,
)
from redash.models.types import (
Configuration,
EncryptedConfiguration,
JSONText,
MutableDict,
Expand Down
13 changes: 1 addition & 12 deletions redash/models/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,10 @@
from sqlalchemy.types import TypeDecorator
from sqlalchemy_utils import EncryptedType

from redash.models.base import db
from redash.utils import json_dumps, json_loads
from redash.utils.configuration import ConfigurationContainer

from .base import db


class Configuration(TypeDecorator):
impl = db.Text

def process_bind_param(self, value, dialect):
return value.to_json()

def process_result_value(self, value, dialect):
return ConfigurationContainer.from_json(value)


class EncryptedConfiguration(EncryptedType):
def process_bind_param(self, value, dialect):
Expand Down

0 comments on commit 97db492

Please sign in to comment.