Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I try the sample code, but error, System.Exception:“The IPFS_PASS environement variable is missing.” #166

Open
billqu01 opened this issue Aug 17, 2022 · 1 comment

Comments

@billqu01
Copy link

My code:
private async void GetData()
{
var ipfs = new IpfsEngine();

        const string filename = "QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/about";
        string text = await ipfs.FileSystem.ReadAllTextAsync(filename);
    }

when run at var ipfs = new IpfsEngine();
the error throw,
System.Exception:“The IPFS_PASS environement variable is missing.”

How should I do?
Thank you very much.

@Myina
Copy link

Myina commented Aug 18, 2022

This occurs when you instantiate the IPFS engine without any arguments. It would expect to read the pass phrase from the system environment in Advanced System Settings > Advanced > Environment Variables > System Variables (on Windows). You can add a pass phrase with a variable name "IPFS_PASS" or use the constructor supporting a SecureString() as shown below.

_engine = new IpfsEngine(new SecureString())
          {
              Options = options
          };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants