Environment variables in file path don't work on Linux
See original GitHub issueI have following config in my JSON file:
"WriteTo": [
{
"Name": "Async",
"Args": {
"configure": [
{
"Name": "File",
"Args": {
"path": "%PROGRAMDATA%/TehGM/fsriev/logs/log-.log",
"rollingInterval": "Day",
"retainedFileCountLimit": 30,
"fileSizeLimitBytes": 2097152,
"rollOnFileSizeLimit": true,
"buffered": false
}
}
]
}
}
]
This works as expected on Windows 10. However, when the application is ran on Debian, folder of name %PROGRAMDATA% is created instead. I also tried %APPDATA%:
When using special folders feature using in-code configuration, they work perfectly fine.
Library version: 3.1.0.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Environment Path Variable Not working properly [duplicate]
So far I've tried( in my .bashrc file):. export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin; exportPATH ...
Read more >How To View and Update the Linux PATH Environment ...
The PATH variable contains a list of directories the system checks before running a command. Updating the PATH variable will enable you to...
Read more >shell - $PATH environment variable does not seem to be ...
In a shell command like. PATH=~/bin:/opt/texbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games. the tilde is expanded to your home ...
Read more >dotenv file is not loading environment variables
How about use require('dotenv').config({path:__dirname+'/./../../.env'}) ? Your problem seems to be the execution path.
Read more >Adding a Path to the Linux PATH Variable
The PATH variable is an environment variable containing an ordered list of paths that Linux will search for executables when running a command....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I would suggest configuring the defaults in code and leaving the user with the option to override the default by setting the path in the configuration file.
@nblumhardt I haven’t tried it, but according to the documentation
%
should also work on Linux: https://docs.microsoft.com/en-us/dotnet/api/system.environment.expandenvironmentvariablesOk, that’s something. Non ideal, but something.
Is there anyworkaround that would work on both Windows and Linux? I want to keep a single configuration file for both, Windows and Linux, so it’s within the same download.