Comments (1)
I figured this out later. The problem is indeed not with permissions but rather the config file not existing at all for the root user when running the app in the background. Basically, this package conf
by default uses user's home directory to create and store configuration file. If the user changes, obviously the home directory changes, hence the unexpected loss of config for your app that might need to run in the background by another user.
The simplest fix for this is that when instantiating conf, you can pass the cwd
option to the constructor which will then use your specified location for storing configuration. If your app has a use case like mine, where the config might be created when the app is set up by a human/another user and then your app has to run as a daemon most likely by user root
or another special user, your best bet is to specify a system wide config directory that's available to all users via the cwd
option. In linux, a standard system-wide config location is the /etc
folder.
Remember that your app running as a root means you will have to deal with the sudo
shenanigans. If you specify a location at /etc
for the cwd
option, then all users will either need to be sudoers or have to use sudo
on each operation of your app in which conf writes to the configuration file. Otherwise, conf will fail with permission denied error.
P.S
@sindresorhus Perhaps this should be mentioned in the Readme? Or at least some more details about the default location of the config file used by conf.
from conf.
Related Issues (20)
- Add a `mode` option HOT 1
- Debouncer causing the onDidChange callbacks to get delayed by 5 seconds when registered multiple times HOT 2
- Bad performance due to slow ajv.compile called. HOT 3
- Store.set is not type checked HOT 1
- onDidChange doesn't support dot-notation for nested properties
- Add option to use other encryption algorithm (i.e., AES-256-GCM) HOT 1
- Ajv is in strictmode HOT 8
- Support for ESM HOT 3
- Show example in readme of loading package.json when targeting Node.js 18
- `validate` after migration. HOT 10
- Is conf typescript-responsive or have type declarations? HOT 3
- "Cannot find module 'conf'" unless setting "moduleResolution": "node16" or "nodenext" HOT 1
- Documentation Request: File Creation & Location.
- Custom storage provider
- copyright-question HOT 2
- Can't import or require Conf from "conf' HOT 1
- Why we can no longer use require('conf') ? HOT 2
- Constructor throws exception if underlying Config is invalid HOT 3
- Switch from Buffer to Uint8Array HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from conf.