Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In the documentation I see:
6. update Drupal's settings.php with required configurations (at least nodejs_service_key).
But in readme.txt I see:
To use your settings file, edit settings.php to add:
$conf['nodejs_config'] = [
// Configuration values here. See nodejs_get_config() function
// for the values you can override.
];
What I need write to the settings.php?
Currently on the page mysite/nodejs/message written the message:
{"error":"Invalid service key."}
Comments
Comment #2
glekli CreditAttribution: glekli commentedYou can put your nodejs module settings into the settings.php file if you need to store the settings in code (as opposed to the database) for some reason. This is mostly useful for developers. If you don't have a need to do that, you can configure nodejs module in Drupal as usual, and ignore that section.
If you do need to store the config in settings.php, look up the variable names in nodejs_get_config(). What you need is the first parameter in each variable_get() call. For example, the service key is stored in the variable called "nodejs_service_key". Having that, you can store the setting in settings.php as follows:
$conf['nodejs_service_key'] = 'mykey';
While checking on this, I realized that the instructions are not consistent. Please do not use the $conf['nodejs_config'] array for now (even though the readme says so). I'll update the documentation and fix the inconsistencies soon.
Comment #3
psyh CreditAttribution: psyh commentedThank you for answer.
I removed config from settings.php, but module not work.
Where I can see logs for the node js?
Comment #4
glekli CreditAttribution: glekli commentedFirst, go to the status page (Reports>Status report) and check if there is any error. If there is nothing there, check the Drupal logs (Reports>Recent log messages).
The nodejs server app will print messages in the console if you start it from the command line. Keep an eye on those too.