-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Package with process.env variables set #259
Comments
Just so I'm clear, the person who packages the app sets an environment variable, and then every person who installs it runs the app with that environment variable set to the exact value that the packager set? |
@malept correct! The whole is for the packager to set env variables that will be consistent amongst all downloaded versions. This is used for setting variables like Google client keys, etc. If you have better solutions, I am certainly open to setting secret api keys, etc. in the app. I'd prefer that over process envs |
Does it have to be an environment variable?
|
@malept sorry, what do you mean by will get picked up by electron-packager? |
For example, in the same location as your |
@malept i am having some trouble with this actually in doing it in an elegant way. There is no way to tell Electron what env it is on after packaged and on opening the application such that it uses some env variables and not others. My only solution is creating and deleting files on packaging or developing which is not elegant in any way. |
Given an app that looks like this:
And a {
"name": "MyApp",
"main": "main.js",
"devDependencies": {
"electron-packager": "^5.2.1",
"electon-prebuilt": "^0.36.0"
}
} I would have a require('frozenenv'); ...and a shell script #!/bin/bash
npm install
echo "process.env.FOOBAR = '$FOOBAR';" > frozenenv.js
electron-packager . --out ../packages --all What it amounts to is a different way of creating a config file. I am not aware of any other method of configuring a packaged app that involves "freezing" environment variables that doesn't look something like this. |
@malept i ended up using |
In my main.js file, I have
process.env
variables set that I need to package and have them set when you open the packaged app. How can I do this? Here is my package.js file:The text was updated successfully, but these errors were encountered: