Before you run#
Use an installed, authenticated Yak CLI with access to the invite-only preview. Read Secrets for the full setup and current behavior.
Python example
Inject an inline Secret and check that its key is available remotely.
Use an installed, authenticated Yak CLI with access to the invite-only preview. Read Secrets for the full setup and current behavior.
import asyncio
import os
import yak
secret = yak.Secret.from_dict({"YAK_DEMO_TOKEN": "preview-demo-value"})
app = yak.App(name="secret-example", secrets=[secret])
@app.task()
def secret_is_available() -> bool:
return bool(os.environ.get("YAK_DEMO_TOKEN"))
@app.entrypoint()
async def main() -> None:
configured = await secret_is_available.remote.aio()
print(f"secret configured: {configured}")
if __name__ == "__main__":
asyncio.run(main())
Save the source as secrets.py, then run:
$ yak run secrets.py