freedmand / semantra

Multi-tool for semantic search
MIT License
2.49k stars 139 forks source link

System-wide .env #48

Closed endolith closed 1 year ago

endolith commented 1 year ago

https://github.com/freedmand/semantra/blob/main/docs/guide_openai.md

Semantra will look in the .env file in the directory it's run in and load the environment variable if found.

Which directory is this on Windows? semantra.exe exists in two places:

But putting the .env file in either of these folders does not work.

freedmand commented 1 year ago

It will look at whatever your current working directory is when you run Semantra. So if you're running Semantra and your terminal is at your home directory, it might be something like C:\username. See here for more info on current working directory in Windows.

endolith commented 1 year ago

Ah, so I need to create a folder for Semantra that contains the .env and then run it from that folder? Even though pipx makes it so I can run semantra from any folder? Can there be a profile-wide .env instead?

freedmand commented 1 year ago

Fixed by #52 and released in v0.1.7. Upgrade by running pipx upgrade semantra.

You can now create a .env file in the Semantra directory that will work globally wherever you run the command. You can reveal this directory by running semantra --show-semantra-dir.

Thanks for your helpful feedback!