Open azamsharpschool opened 1 month ago
@azamsharpschool what's the location of your .env
file? The default path is .env
but your file might not be located there. Assuming that you're developing a script? If you're developing for an iOS application or another platform, then you'll have change the default file path from .env
to wherever the file lives but then you'll have to include the file in your app bundle which defeats the purpose of using this library in the first place.
I think it's not clear from the README and I can update it because this isn't the first time it's come up but this library is for scripting only when using in conjunction with a .env
file. If you just want to read environment values from the underlying process, you can (it just proxies to processInfo.environment
) but loading a .env
file into an application would mean you have to include it in your bundle and in your version control.
So, where should we put this .env
file iOS? the same location as Xcode project file?
No, you don't use .env files for iOS applications; it's for scripting only. Think about it, it doesn't make sense. In order for the iOS application to be able to see the environment file, it would have to be included in the bundle. And even if you manage to keep it out of version control, you're still loading that file into the application bundle that gets distributed to users.
Dotenv.configure() is throwing exception
Fatal error: 'try!' expression unexpectedly raised an error: SwiftDotenv.Dotenv.LoadingFailure.environmentFileIsMissing
even though I have a file called .env with keys and values.