#```python
1 messages ยท Page 1 of 1 (latest)
that's pretty much it, but yeah, will in one sec
dagger mod sync passes, but dagger functions fails
as does dagger call --help
little more from that
lol. I got caught up and forgot to install the infisical package. Let's try that, shall we ๐
Do you do your dev in a venv and such?
I haven't bothered because I haven't included any dependencies, but yeah theoretically you should. I think infisical should go in your pyproject.toml as a dependency
sheesh, feels like there should be a pip command variant to add a dep to the pyproject.toml
[project]
name = "main"
version = "0.0.0"
dependencies = [
'infisical>=1.5.0'
]
going with this. let's see
Worked so far! ๐ค
whoops. clearly can't read an env var. So will make the token a secret input to start. Then will move to the object.
import os
import dagger
from dagger.mod import function
from infisical import InfisicalClient
@function
def get_secret(t: str) -> str:
inf_client = InfisicalClient(token=t)
url = inf_client.get_secret("DATABASE_URL", environment="dev", path="/")
return f"Hello! The db url is: {url.secret_value}"
dagger call getSecret --t=$INF_TOKEN
๐
pyproject.toml
[project]
name = "main"
version = "0.0.0"
dependencies = [
'infisical>=1.5.0'
]
noice!
Now to figure out secrets....
I thought this should work
def get_secret(token: dagger.Secret) -> str:
inf_client = InfisicalClient(token=dagger.Secret.plaintext(token))
but...
not 100% sure but I think you might need an await to get the plaintext
makes sense with the async
import os
import dagger
from dagger.mod import function
from infisical import InfisicalClient
@function
async def get_secret(token: dagger.Secret) -> str:
inf_client = InfisicalClient(token=await dagger.Secret.plaintext(token))
url = inf_client.get_secret("DATABASE_URL", environment="dev", path="/")
return f"Hello! The db url is: {url.secret_value}"
This works! Thanks @lament pond ๐