Skip to content

Commit 80d4250

Browse files
committed
Use generate_dual_core_model for DecryptedString
1 parent 89f6213 commit 80d4250

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/dstack/_internal/server/models.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
from dstack._internal.core.errors import DstackError
2626
from dstack._internal.core.models.backends.base import BackendType
27-
from dstack._internal.core.models.common import CoreModel
27+
from dstack._internal.core.models.common import CoreConfig, generate_dual_core_model
2828
from dstack._internal.core.models.fleets import FleetStatus
2929
from dstack._internal.core.models.gateways import GatewayStatus
3030
from dstack._internal.core.models.health import HealthStatus
@@ -71,7 +71,11 @@ def process_result_value(self, value, dialect):
7171
return value.replace(tzinfo=timezone.utc)
7272

7373

74-
class DecryptedString(CoreModel):
74+
class DecryptedStringConfig(CoreConfig):
75+
arbitrary_types_allowed = True
76+
77+
78+
class DecryptedString(generate_dual_core_model(DecryptedStringConfig)):
7579
"""
7680
A type for representing plaintext strings encrypted with `EncryptedString`.
7781
Besides the string, stores information if the decryption was successful.
@@ -84,9 +88,6 @@ class DecryptedString(CoreModel):
8488
decrypted: bool = True
8589
exc: Optional[Exception] = None
8690

87-
class Config(CoreModel.Config):
88-
arbitrary_types_allowed = True
89-
9091
def get_plaintext_or_error(self) -> str:
9192
if self.decrypted and self.plaintext is not None:
9293
return self.plaintext

0 commit comments

Comments
 (0)