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

Use dotenv and provide example #743

Closed
andersevenrud opened this issue May 11, 2020 · 6 comments
Closed

Use dotenv and provide example #743

andersevenrud opened this issue May 11, 2020 · 6 comments

Comments

@andersevenrud
Copy link
Member

Split out from #742

It would be nice to use dotenv by default to allow overriding the very basic foo/config.js defaults, as well as a .env.example for reference.

This could probably also contain the docker-composer variables as well.

@andersevenrud
Copy link
Member Author

I added a section about this in the manual. So I'm closing this issue.

os-js/manual.os-js.org@3ed7080

Since I'm doing some passes on the manuals at this moment this will get better documented.

@maryam4s26
Copy link

hi @andersevenrud.
I want to manually set the parameters in the server and client config files through the . env are initialized.
So I have added the .env file to the project.
I have used it in the server configuration file as follows.

require('dotenv').config();
module.exports = {
  root,
  port: process.env.PORT,
  public: path.resolve(root, 'dist'),
}

I have also used the following in the client config file.

import 'dotenv/config';
export default {
  session:{
    timeout: process.env.CLIENT_SESSION_TIMEOUT
  },
}

But in the client, I get the value of timeout parameter as undefined.

@andersevenrud
Copy link
Member Author

Didn't you solve this here os-js/osjs-client#208 ?

@andersevenrud

This comment was marked as outdated.

@andersevenrud
Copy link
Member Author

Didn't you solve this here os-js/osjs-client#208 ?

Hm. Come to think of it you probably might have to add a Webpack plugin. Try https://github.com/mrsteele/dotenv-webpack, but with an older version (6.x.x) for the webpack used here.

The standalone dotenv package probably won't work here.

@maryam4s26
Copy link

Didn't you solve this here os-js/osjs-client#208 ?

This issue os-js/osjs-client#208 was for use in Docker.
Here is the question for developer mode.

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