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

config module is not able to read env variables from .env file #905

Closed
ghost opened this issue Jan 10, 2024 · 2 comments · Fixed by #911
Closed

config module is not able to read env variables from .env file #905

ghost opened this issue Jan 10, 2024 · 2 comments · Fixed by #911
Assignees
Labels
bad ux Providing information that is not clear or causing confusion for the user. bug Something isn't working

Comments

@ghost
Copy link

ghost commented Jan 10, 2024

Version Information

@godspeedsystems/core package version: "2.2.3"

Current Behavior

I have defined a custom environment variable in config/custom-environment-variables.yaml
f_token: F_TOKEN

The env variable is set in the .env file in the project directory.
F_TOKEN=/dev/F_AUTH_TOKEN

When I am trying to access this variable in the workflow then it is not able to read from config. Below is the workflow:
image

If I set the variable in the terminal using export command like export F_TOKEN=/dev/F_AUTH_TOKEN then it is working fine.

Expected Behavior

config should read env variables from .env file also.

Screenshot

image

@ghost ghost added bug Something isn't working bad ux Providing information that is not clear or causing confusion for the user. labels Jan 10, 2024
@ghost ghost assigned ghost and unassigned ghost Jan 10, 2024
@mastersilv3r
Copy link
Contributor

The solution is this
In your godspeed project's package.json add change two commands to include mappings, plugins and configs to be copied from src to dist, and also to be watched

"build": "swc src -d dist && rsync -a --exclude '*.ts' ./src/ ./dist/ && rsync -a --exclude '*.ts' ./mappings/ ./dist/mappings && rsync -a --exclude '*.ts' ./config/ ./dist/config",
"serve": "nodemon --watch src --watch config --watch mappings --watch plugins -e ts,js,yaml,json,.env --exec 'npm run build && npm run preview'",

@gurjotkaur20
Copy link
Contributor

The solution is this In your godspeed project's package.json add change two commands to include mappings, plugins and configs to be copied from src to dist, and also to be watched

"build": "swc src -d dist && rsync -a --exclude '*.ts' ./src/ ./dist/ && rsync -a --exclude '*.ts' ./mappings/ ./dist/mappings && rsync -a --exclude '*.ts' ./config/ ./dist/config",
"serve": "nodemon --watch src --watch config --watch mappings --watch plugins -e ts,js,yaml,json,.env --exec 'npm run build && npm run preview'",

I guess there is a small issue in the build command. mappings folder will be inside src, so ./src/mappings/ should be mentioned.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bad ux Providing information that is not clear or causing confusion for the user. bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants