• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Is it possible to have custom information for each module in the config file?

Scheduled Pinned Locked Moved Development
2 Posts 1 Posters 804 Views 1 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    Veldrovive Module Developer
    last edited by Jul 16, 2018, 2:18 AM

    In order to improve the usability of my page system, I would like to be able to use a custom piece of information in the config file to define pages and positions for the Modules.

    {
        "module": "clock",
        "position": "top_right",
        "pages": {"pageName": "position"},
        "config": {}
    }
    

    However, it seems just using getModules.enumerate() doesn’t supply that new pages object.
    As a workaround, I noticed that the config for each module is given and so the page’s object could be stored inside that. However, for less confusing use, I would rather have it outside.
    The other option I would explore is simply importing the config into my node_helper and then parsing the config manually, but before I went ahead with the plan I wanted to see if there is some reason to refrain from that.

    Is there a correct way to do this? Is it correct to do this at all?

    1 Reply Last reply Reply Quote 0
    • V Offline
      Veldrovive Module Developer
      last edited by Jul 16, 2018, 3:07 AM

      After trying out the method of importing the config, it works well and seems to be stable. If anyone has any reason why not to require the config.js in a node_helper file, I would appreciate an explanation.

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      1 / 1
      • First post
        1/2
        Last post
      Enjoying MagicMirror? Please consider a donation!
      MagicMirror created by Michael Teeuw.
      Forum managed by Sam, technical setup by Karsten.
      This forum is using NodeBB as its core | Contributors
      Contact | Privacy Policy