I can see in the console, that the config file reads successfully
PS D:\nodeJS\global> .\n8n start
User settings loaded from: C:\Users\me\.n8n\config
Initializing n8n process
n8n ready on 0.0.0.0, port 5678
Version: 1.38.1
But the log level remains the default. That’s how I test it in the custom node:
this.logger.info("i transport > apiRequest called")
this.logger.warn("w transport > apiRequest called")
this.logger.error("e transport > apiRequest called")
this.logger.debug("d transport > apiRequest called")
this.logger.verbose("v transport > apiRequest called")
And the output:
Press "o" to open in Browser.
i transport > apiRequest called
w transport > apiRequest called
e transport > apiRequest called
I just checked my local install and the below is working for me, Are you using the .n8n/config file or creating your own using the N8N_CONFIG_FILE env option?
no success… If I use the invalid syntax, then it shows that there is an error with the config. So n8n is reading it but ignores the content. Maybe it’s a Windows only issue?
Well… I’ve researched how the settings work a little and for me, it’s acting weird…
n8n has two places, which work with env/config:
ENVs are being loaded within the dotenv and config packages and this definition. The interesting part here is that it completely ignores the config file, located in the user profile folder on Windows.
config file from the user profile folder is being loaded within this definition. But I do not see how it syncs the variables with config package…
So if I specify the port variable in the config, it won’t be used, because n8n tries to get the port from the env variable and doesn’t look into the “config” in my case:
const PORT = config.getEnv('port');
const ADDRESS = config.getEnv('listen_address');
That config.getEnv here contains only the base ENVs, that are being loaded on the startup…
And, according to that part, at least on Windows, the variable will be undefined
const { N8N_CONFIG_FILES } = process.env;
So I am a bit confused about how the InstanceSettings.ts should work with the config package
Well… It worked when I used a little hack by modifying the InstanceSettings.js (from <n8n_global>\node_modules\n8n\node_modules\n8n-core\dist\InstanceSettings.js) file just to make sure that I was on the right way.
I’ve added the line process.env.N8N_PORT = settings.port
just before this one and now the port has changed.
So it seems the issue is that the user profile config (C:\Users\username\.n8n\config) is not read by the config package
But the server confused me with the message: User settings loaded from: C:\Users\grave\.n8n\config
So I thought that it’s the default config to work with. But that one is totally different and should not be used as a user “settings”, it’s rather a server’s internal settings.
I have looked for the information on where the default config file may be read from, but haven’t found anyone