Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

Custom config file directory is not working #47

Open
fedealconada opened this issue Jul 22, 2020 · 2 comments · May be fixed by #48
Open

Custom config file directory is not working #47

fedealconada opened this issue Jul 22, 2020 · 2 comments · May be fixed by #48

Comments

@fedealconada
Copy link

The code below is the one that allows someone to specifiy a different directory for the getstream.js config file"

if (typeof process != 'undefined' && process.env.STREAM_NODE_CONFIG_DIR) {
		config_file = process.env.STREAM_NODE_CONFIG_DIR + '/getstream.js';
	} else {
		config_file = process.cwd() + '/getstream.js';
	}

The main problem is that, in case we specify a value for STREAM_NODE_CONFIG_DIR this will always be some path relative to the project. Therefore, we must append the process.cwd() to the url.

Moreover, I'm working now with Node v14 and, because of compatibility things, I need to specifiy getstream.js with the .cjs extension. But this is not possible with the current setup because stream-node-orm is forcing us to use a file named getstream.js.

My proposal is just to use a STREAM_NODE_CONFIG_PATH variable that would be path to a file and not a directory path.

@fedealconada fedealconada linked a pull request Jul 22, 2020 that will close this issue
@ferhatelmas
Copy link
Contributor

Why can't you specify an absolute path? Additionally, that would be a breaking change (DIR to PATH).

For the latest node compatibility, we need "type": "module" in package.json which is again a breaking change.

/cc @mahboubii

@fedealconada
Copy link
Author

fedealconada commented Aug 1, 2020

Why can't you specify an absolute path? Additionally, that would be a breaking change (DIR to PATH).

For the latest node compatibility, we need "type": "module" in package.json which is again a breaking change.

/cc @mahboubii

Because to do that, I should know exactly the server's absolute path, it's just not comfortable to write something like: STREAM_NODE_CONFIG_DIR=/Users/myusername/Development/myproject/ as a path. And then, for production, when I deploy this, I might not know exactly the absolute path on the server.... It's much convenient using a relative path.
And regarding not using getstream.jsit's just to have more flexibility on how we want to name the file, or even use other js extension. Actually, at stream-js you are not limiting the file name (see here).

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

Successfully merging a pull request may close this issue.

2 participants