JobSathi_Backend / sync_secrets.py
AhmedShahan's picture
Add GitHub Actions workflows for deploying and syncing secrets to HuggingFace
ec2aa96
Raw History Blame Contribute Delete
692 Bytes
import os
from huggingface_hub import HfApi
SPACE_ID = "AhmedShahan/JobSathi_Backend"
ENV_FILE = ".env"
def main():
token = os.environ["HF_TOKEN"]
api = HfApi(token=token)
with open(ENV_FILE, "r") as f:
for line in f:
line = line.strip()
if not line or line.startswith("#") or "=" not in line:
continue
key, value = line.split("=", 1)
key = key.strip()
value = value.strip().strip('"').strip("'")
if not key:
continue
api.add_space_secret(repo_id=SPACE_ID, key=key, value=value)
print(f"Synced: {key}")
if __name__ == "__main__":
main()