#```python

1 messages ยท Page 1 of 1 (latest)

wanton remnant
#

there might be an error getting buried. Can you push your code?

torpid obsidian
#

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?

wanton remnant
#

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

torpid obsidian
#

sheesh, feels like there should be a pip command variant to add a dep to the pyproject.toml

wanton remnant
#

I can't help you there ๐Ÿ˜ ๐Ÿ

#

seemed like it's all poetry

torpid obsidian
#
[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' 
]
wanton remnant
#

noice!

torpid obsidian
#

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...

lament pond
torpid obsidian
#

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 ๐Ÿ™Œ