Can't find constants in meta.config
-
I write a plugin using nodebb-plugin-quickstart as model. My plugin required two constants defined in admin control panel. These two constants are correctly saved somewhere as there are loaded in the ACP after nodebb reboot. The problem is that I can't access these constants through meta.config.
When I check the meta.config my two constants are not there.
Any idea what's going wrong?Some additional information.
The ACP template<div class="row"> <div class="col-lg-9"> <div class="panel panel-default"> <div class="panel-heading">Franco Bowl setting page</div> <div class="panel-body"> <form role="form" class="francobowl-settings"> <div class="form-group"> <label for="secret_key">JWT secret key</label> <input type="text" id="secret_key" name="secret_key" title="JWT secret key" class="form-control" placeholder="The JWT secret key"><br /> </div> <div class="form-group"> <label for="fb_ws_url">Franco Bowl Webservice root url</label> <input type="text" id="fb_ws_url" name="fb_ws_url" title="FB webservice root url" class="form-control" placeholder="The Franco Bowl webservice root url"> </div> </form> </div> </div> </div> <div class="col-lg-3"> <div class="panel panel-default"> <div class="panel-heading">Control Panel</div> <div class="panel-body"> <button class="btn btn-primary" id="save">Save Settings</button> </div> </div> </div> </div>
The admin.js
define('admin/plugins/francobowl', ['settings'], function(Settings) { 'use strict'; /* globals $, app, socket, require */ var ACP = {}; ACP.init = function() { Settings.load('francobowl', $('.francobowl-settings')); $('#save').on('click', function() { Settings.save('francobowl', $('.francobowl-settings'), function() { app.alert({ type: 'success', alert_id: 'francobowl-saved', title: 'Settings Saved', message: 'Franco Bowl settings saved', clickfn: function() { socket.emit('admin.reload'); } }); }); }); }; return ACP; });
-
The meta.settings object saves to the database and doesn't keep a local copy, and that get() method retrieves your data from the database.
But the Settings Framework does keep a local copy, I recommend looking at that.
https://docs.nodebb.org/en/latest/plugins/settings.html -
meta.config
contains settings from NodeBB itself. Plugins retrieve their own settings via thesettings
module on the client side.In the case of quickstart, you can retrieve the settings the same way the settings are retrieved in the plugin's ACP page, with
Settings.load