Can't find constants in meta.config

Plugin Development
  • #1

    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" 
                                   title="JWT secret key" 
                                   placeholder="The JWT secret key"><br />
                        <div class="form-group">
                            <label for="fb_ws_url">Franco Bowl Webservice root url</label>
                            <input type="text" 
                                   title="FB webservice root url" 
                                   placeholder="The Franco Bowl webservice root url">
        <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>

    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() {
      'francobowl', $('.francobowl-settings'), function() {
                        type: 'success',
                        alert_id: 'francobowl-saved',
                        title: 'Settings Saved',
                        message: 'Franco Bowl settings saved',
                        clickfn: function() {
        return ACP;
  • #2

    Finally I can access the constants through

    meta.settings.get('francobowl', function(err, settings){})

    But I'm curious to know why the constants aren't accesible in the meta.setting object.

  • Community Rep

    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.

  • GNU/Linux

    meta.config contains settings from NodeBB itself. Plugins retrieve their own settings via the settings 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

Suggested Topics

| | | |