Skip to content

Commit 47cfdaa

Browse files
authored
Merge pull request #2 from bellini666/feat/social-set-id-env-var
2 parents 8b1ac3c + 945a5f7 commit 47cfdaa

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/strawberry_autopub_plugins/typefully.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414

1515

1616
class TypefullyConfig(BaseModel):
17-
social_set_id: str = Field(validation_alias="social-set-id")
17+
social_set_id: str = Field(
18+
default_factory=lambda: os.environ.get("TYPEFULLY_SOCIAL_SET_ID", ""),
19+
validation_alias="social-set-id",
20+
)
1821
platforms: list[Literal["x", "linkedin", "threads", "bluesky", "mastodon"]] = Field(
1922
default_factory=lambda: ["x"],
2023
)
@@ -176,6 +179,11 @@ def _create_draft(self, body: dict[str, object]) -> None:
176179
) from exc
177180

178181
def post_publish(self, release_info: ReleaseInfo) -> None:
182+
if not self.config.social_set_id:
183+
raise _autopub_error(
184+
"social-set-id config or TYPEFULLY_SOCIAL_SET_ID environment variable is required"
185+
)
186+
179187
body = self._build_request_body(release_info)
180188

181189
if self.config.dry_run:

0 commit comments

Comments
 (0)