plouc / mozaik-ext-twitter

Mozaïk twitter widgets
MIT License
4 stars 3 forks source link

'cannot find configuration param' error convict.js #2

Closed ThrowingSpoon closed 9 years ago

ThrowingSpoon commented 9 years ago

Hi,

Just tried to add the twitter widget to a test mozaik dashboard, but cannot seem to fix this error...

When I put my API keys in the main config.js file in mozaik\config.js it gives my this error:

c:\git\Twitter test\mozaik\node_modules\mozaik-ext-twitter\node_modules\convict\
lib\convict.js:306
          throw new Error("cannot find configuration param '" + path + "'");
                ^
Error: cannot find configuration param 'consumerKey'
    at walk (c:\git\Twitter test\mozaik\node_modules\mozaik-ext-twitter\node_modules\convict\lib\convict.js:306:17)
    at Object.rv.get (c:\git\Twitter test\mozaik\node_modules\mozaik-ext-twitter\node_modules\convict\lib\convict.js:325:15)
    at client (c:\git\Twitter test\mozaik\node_modules\mozaik-ext-twitter\lib\client.js:16:30)
    at Bus.registerApi (c:\git\Twitter test\mozaik\node_modules\mozaik\lib\Bus.js:43:33)
    at Object.<anonymous> (c:\git\Twitter test\mozaik\app.js:3:12)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

Then I placed my twitter keys directly in:

\mozaik\node_modules\mozaik-ext-twitter\lib\client.js

Here is the section of the client.js file (path above) (blanked out the twitter keys):

 var twitter = new Twitter({
          consumerKey:          'Key put here',
          consumerSecret:       'Key put here',
          accessTokenKey:       'Key put here',
          accessTokenSecret:    'Key put here'
    });

The dashboard runs fine and says that info: registered API "twitter", then listens on the usual localhost port, but when I go to localhost:5000 I just get a blank dashboard (In this case I have only tried to display some twitter information)

Here is the section of my config.js file, using the example usage code I took off of the mozaik-ext-twitter readme example

dashboards: [
        {
            columns: 4, rows: 3,
            widgets: [
            {
                type:     'twitter.hashtags_pie',
                layout:   'right',
                hashtags: [
                    { color: '#6bc2c8', text: 'apple'      },
                    { color: '#5f8cc0', text: 'google'     },
                    { color: '#525487', text: 'twitter'    },
                    { color: '#376aa2', text: 'facebook'   },
                    { color: '#383b72', text: 'instagram'  }
                ],
                columns: 2, rows: 1, x: 0, y: 0
            }
            ]
        }
    ]

I am just looking to display any twitter information on a Mozaik dashboard. Can anybody help me please?

Thanks, Liam.

P.S If anyone can show me where to find the correct value to put in for the 'type' and parameters for dashboard widgets by looking in the correct 'node_modules' or whatever, it would be greatly appreciated! :)

plouc commented 9 years ago

@ThrowingSpoon I fixed some issues with the extension (https://github.com/plouc/mozaik-ext-twitter/commit/bb9f25a675e846a82d8ff62404d9cf963271966e) A sample config:

// Load environment variables from .env file if available
require('dotenv').load();

var config = {
    env:  'prod',

    host: 'localhost',
    port: process.env.PORT || 5000,

    theme: 'night-blue',

    // clients configs
    api: {
        twitter: {
            consumerKey:       'xxxxx',
            consumerSecret:    'xxxxx',
            accessTokenKey:    'xxxxx',
            accessTokenSecret: 'xxxxx'
        }
    },

    // define duration beetwen each dashboard rotation (ms)
    rotationDuration: 4000,

    dashboards: [
        {
            columns: 4, rows: 3,
            widgets: [
                {
                    type:     'twitter.hashtags_pie',
                    layout:   'right',
                    hashtags: [
                        { color: '#6bc2c8', text: 'apple'      },
                        { color: '#5f8cc0', text: 'google'     },
                        { color: '#525487', text: 'twitter'    },
                        { color: '#376aa2', text: 'facebook'   },
                        { color: '#383b72', text: 'instagram'  }
                    ],
                    columns: 2, rows: 1, x: 0, y: 0
                }
            ]
        }
    ]
};

module.exports = config;
ThrowingSpoon commented 9 years ago

@plouc Thank you very much for making the changes, it is Twitter hashtag pie charts are working great!

Could you point me in the right direction as to where I should look if I want to find the correct parameters for all of your widgets? for example where would I look (if there is no readme or example available) to find that you have a widget of type 'twitter.hashtags_pie' and that it will take layout, hashtags and columns parameters.

Essentially what I want to do is be able to implement all of your widgets on a dashboard, even if there is no readme or example available.

Thanks :)

Liam.

plouc commented 9 years ago

@ThrowingSpoon you can list available widgets by searching on npm for mozaik https://www.npmjs.com/search?q=mozaik I tried to add component docs for most of the available extensions, if you find some where it's missing, don't hesitate to create an issue on the corresponding repo, I'll try to update it. You also have a list of some extensions on the wiki with the corresponding doc link https://github.com/plouc/mozaik/wiki/Widgets. I close this issue as it's related to twitter extension which seem to be fixed, feel free to re-open if you experience other problems.