#Can you try that with loading from the

1 messages · Page 1 of 1 (latest)

granite bear
#
func main() {
    ctx := context.Background()
    d, err := dagger.Connect(ctx)
    if err != nil {
        panic(err)
    }
    os.Setenv("FOO", "bar")
    secretID, err := d.Host().EnvVariable("FOO").Secret().ID(ctx)
    if err != nil {
        panic(err)
    }
    secret := d.Secret(secretID)

    plaintext, err := d.Container().From("alpine").
        WithMountedSecret("/secret", secret).Exec(dagger.ContainerExecOpts{
        Args: []string{"cat", "/secret"},
    }).Stdout().Contents(ctx)
    if err != nil {
        panic(err)
    }
    fmt.Println(plaintext)
}
blissful grove
#

Hmm... Ok. Maybe something is getting lost along the way. I'll keep digging.

#

Thanks for the extra eyes, @granite bear

#

😕

granite bear
#

if err := v.FillPath(secretIDPath, id); err != nil {

#

maybe string(id)? perhaps FillPath is doing something weird because of the SecretID type

blissful grove
#

Yeah, I'll dig into that. I might have also missed a couple of bit of secretContext code that need to change (which are used in the exec.go code when parsing the mounts).