mirror of
https://github.com/YunoHost-Apps/nodered_ynh.git
synced 2024-09-03 19:46:25 +02:00
Merge pull request #48 from fflorent/testing
Add file for user specific settings
This commit is contained in:
commit
aa42d6c069
7 changed files with 111 additions and 3 deletions
|
@ -1,3 +1,11 @@
|
|||
// CAUTION: DO NOT EDIT THIS FILE. Rather go to and edit `__FINALPATH__/settings.user.js`
|
||||
|
||||
|
||||
const getUserSettings = require('./settings.user');
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This is the default settings file provided by Node-RED.
|
||||
*
|
||||
|
@ -20,7 +28,7 @@
|
|||
*
|
||||
**/
|
||||
|
||||
module.exports = {
|
||||
const defaultSettings = Object.freeze({
|
||||
|
||||
/*******************************************************************************
|
||||
* Flow File and User Directory Settings
|
||||
|
@ -483,4 +491,9 @@ module.exports = {
|
|||
// * - reason: if result is false, the HTTP reason string to return
|
||||
// */
|
||||
//},
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
...defaultSettings,
|
||||
...getUserSettings(defaultSettings),
|
||||
};
|
||||
|
|
46
conf/settings.user.js
Normal file
46
conf/settings.user.js
Normal file
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
*
|
||||
* This is where you you can as a user define and even override the default settings.
|
||||
* This file will remain untouched by the yunohost package accross upgrades.
|
||||
*
|
||||
* It can contain any valid JavaScript code that will get run when Node-RED
|
||||
* is started.
|
||||
*
|
||||
* Lines that start with // are commented out.
|
||||
* Each entry should be separated from the entries above and below by a comma ','
|
||||
*
|
||||
* For more information about individual settings, refer to the documentation:
|
||||
* https://nodered.org/docs/user-guide/runtime/configuration
|
||||
*
|
||||
* The settings are split into the following sections:
|
||||
* - Flow File and User Directory Settings
|
||||
* - Security
|
||||
* - Server Settings
|
||||
* - Runtime Settings
|
||||
* - Editor Settings
|
||||
* - Node Settings
|
||||
*
|
||||
**/
|
||||
|
||||
module.exports = (defaultSettings) => ({
|
||||
/**
|
||||
* Put here your own config, it will override the ones in settings.js
|
||||
*
|
||||
* Example:
|
||||
* ```js
|
||||
* module.exports = (defaultSettings) => ({
|
||||
* lang: "de", // define the language as "de"
|
||||
* exportGlobalContextKeys: true, // override the `exportGlobalContextKeys` value
|
||||
*
|
||||
*
|
||||
* logging: { // replace the default logging option
|
||||
* ...defaultSettings.logging, // this will reinject the default settings in logging
|
||||
* console: {
|
||||
* ...defaultSettings.logging.level, // this will reinject the default settings in logging.console
|
||||
* level: "debug", // but here, we override the "info" level by "debug"
|
||||
* },
|
||||
* },
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
});
|
|
@ -8,3 +8,22 @@ It provides a browser-based editor that makes it easy to wire together flows usi
|
|||
- On-click deployment of the flows
|
||||
- Over 225,000 modules available
|
||||
- Custom JavaScript functions can be written
|
||||
|
||||
### Override the default settings
|
||||
|
||||
From the installation directory, go edit the `data/settings.user.js`. For example:
|
||||
|
||||
```js
|
||||
module.exports = (defaultSettings) => ({
|
||||
lang: "de", // define the language as "de"
|
||||
exportGlobalContextKeys: true, // override the `exportGlobalContextKeys` value
|
||||
logging: { // replace the default logging option ...defaultSettings.logging, // this will reinject the default settings in logging
|
||||
console: {
|
||||
...defaultSettings.logging.level, // this will reinject the default settings in logging.console
|
||||
level: "debug", // but here, we override the "info" level by "debug"
|
||||
},
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
You can check the default settings Yunohost generates at `data/settings.js` and find the documentation for configuring Node-RED here: https://nodered.org/docs/user-guide/runtime/configuration
|
||||
|
|
|
@ -8,3 +8,25 @@ Il propose un éditeur accessible dans le navigateur, qui facilite l'ébauche de
|
|||
- Déploiement des flux en un clic
|
||||
- Plus de 225 000 modules disponibles
|
||||
- Fonctions personnalisées en JavaScript
|
||||
|
||||
|
||||
### Surcharger la configuration par défaut
|
||||
|
||||
Depuis le répertoire d'installation, éditer le fichier `data/settings.user.js`. Par exemple
|
||||
|
||||
```js
|
||||
module.exports = (defaultSettings) => ({
|
||||
lang: "de", // définit la langue de l'IHM comme allemande
|
||||
exportGlobalContextKeys: true, // surcharger la valeur de `exportGlobalContextKeys`
|
||||
|
||||
logging: { // remplacer l'option par défaut pour la journalisation (logging)
|
||||
...defaultSettings.logging, // cela réinjectera les paramètres par défaut dans `logging`
|
||||
console: {
|
||||
...defaultSettings.logging.level, // cela réinjectera les paramètres par défaut dans `logging.console`
|
||||
level: "debug", // mais isi, nous surchargeons le niveau "info" par "debug"
|
||||
},
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
Vous pouvez consulter les paramètres par défaut générez par Yunohost dans `data/settings.js` et trouver la documentation pour configurer Node-RED ici: https://nodered.org/docs/user-guide/runtime/configuration
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Flow-based programming for the Internet of Things",
|
||||
"fr": "Programmation par flux de données pour l'Internet des objets"
|
||||
},
|
||||
"version": "2.1.4~ynh1",
|
||||
"version": "2.1.4~ynh2",
|
||||
"url": "https://nodered.org",
|
||||
"upstream": {
|
||||
"license": "Apache-2.0",
|
||||
|
|
|
@ -107,6 +107,7 @@ ynh_add_nginx_config
|
|||
# Set up the settings file
|
||||
mkdir -p $final_path/data
|
||||
ynh_add_config --template="../conf/settings.js" --destination="$final_path/data/settings.js"
|
||||
ynh_add_config --template="../conf/settings.user.js" --destination="$final_path/data/settings.user.js"
|
||||
|
||||
# Small hack to have the "/" path answer with a 200 code to satisfy the CI
|
||||
if [[ "${PACKAGE_CHECK_EXEC:-}" = "1" ]] ; then
|
||||
|
@ -120,6 +121,8 @@ fi
|
|||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app: "$final_path"
|
||||
# make settings.js readonly
|
||||
chmod a-w "$final_path/data/settings.js"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
|
|
@ -175,6 +175,9 @@ ynh_add_nginx_config
|
|||
|
||||
# Set up the settings file
|
||||
ynh_add_config --template="../conf/settings.js" --destination="$final_path/data/settings.js"
|
||||
if [[ ! -f "$final_path/data/settings.user.js" ]] ; then
|
||||
ynh_add_config --template="../conf/settings.user.js" --destination="$final_path/data/settings.user.js"
|
||||
fi
|
||||
|
||||
# Small hack to have the "/" path answer with a 200 code to satisfy the CI
|
||||
if [[ "${PACKAGE_CHECK_EXEC:-}" = "1" ]] ; then
|
||||
|
@ -207,6 +210,8 @@ ynh_add_systemd_config
|
|||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app: "$final_path"
|
||||
# make settings.js readonly
|
||||
chmod a-w "$final_path/data/settings.js"
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
|
|
Loading…
Reference in a new issue