Skip to content

Commit 65289f5

Browse files
committed
feat(config): add ShipStation settings and headers
1 parent 095eecb commit 65289f5

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

src/app/core/config.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,30 @@ class CORSSettings(BaseSettings):
148148
CORS_METHODS: list[str] = ["*"]
149149
CORS_HEADERS: list[str] = ["*"]
150150

151+
class ShipStationEnv(str, Enum):
152+
SANDBOX = "sandbox"
153+
PRODUCTION = "production"
154+
155+
class ShipStationSettings(BaseSettings):
156+
SHIPSTATION_ENV: ShipStationEnv = ShipStationEnv.SANDBOX
157+
158+
SHIPSTATION_API_KEY: SecretStr = SecretStr("")
159+
SHIPSTATION_BASE_URL: str = "https://api.shipstation.com"
160+
SHIPSTATION_TIMEOUT_SECONDS: int = 30
161+
162+
@computed_field # type: ignore[prop=decorator]
163+
@property
164+
def SHIPSTATION_ENV_VALUE(self) -> str:
165+
return self.SHIPSTATION_ENV.value
166+
167+
@computed_field # type: ignore[prop=decorator]
168+
@property
169+
def SHIPSTATION_HEADERS(self) -> dict[str, str]:
170+
# Api-key
171+
key = self.SHIPSTATION_API_KEY.get_secret_value()
172+
return {"api-key": key, "Accept": "application/json"}
173+
174+
151175

152176
class Settings(
153177
AppSettings,
@@ -164,6 +188,7 @@ class Settings(
164188
CRUDAdminSettings,
165189
EnvironmentSettings,
166190
CORSSettings,
191+
ShipStationSettings
167192
):
168193
model_config = SettingsConfigDict(
169194
env_file=os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", ".env"),

0 commit comments

Comments
 (0)