• 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.

Create another config.js file

Scheduled Pinned Locked Moved General Discussion
config.js
6 Posts 3 Posters 1.0k Views 3 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.
  • B Offline
    BigMan
    last edited by Nov 6, 2019, 10:36 PM

    Hi, so for a project that I’m working on, I want to create multiple config.js files and name them like config1.js, config2.js and etc. But in order to open on of them (so like the config2.js for example) while booting the MagicMirror, I need to change the path or the configuration that defaults it to config.js. Does anyone know how I can do that?

    S S 2 Replies Last reply Nov 6, 2019, 11:41 PM Reply Quote 0
    • S Away
      sdetweil @BigMan
      last edited by Nov 6, 2019, 11:41 PM

      @BigMan I would create different scripts, and copy your specific config.js into the config folder as config.js.

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 0
      • B Offline
        BigMan
        last edited by Nov 6, 2019, 11:59 PM

        @sdetweil can you please elaborate more on your response. If you can, with examples too. Thanks!

        S 1 Reply Last reply Nov 7, 2019, 12:22 AM Reply Quote 0
        • S Away
          sdetweil @BigMan
          last edited by Nov 7, 2019, 12:22 AM

          @BigMan create a folder called ~/MagicMirror/myConfigs
          place you config1, config2 … confign…js in there

          MM starts with a script installers/mm.sh (or u can create your own)

          anyhow…

          lets create run1.sh in installers

          #!/bin/bash
          # copy my config.js into the folder with the required name
          cp ~/MagicMirror/myConfigs/config1.js ~/MagicMirror/config/config.js
          # then call mm.sh
          exec ~/MagicMirror/installers/mm.sh
          

          then after saving, do

          chmod +x run1.sh
          

          then whenever u want to run MM with config1

          just do

          ~/MagicMirror/installers/run1.sh
          

          u can shorten the commands if u are in the MagicMirror folder at the time…

          create as many run?.sh as u need

          I might save the original config.js in your folder too

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          S 1 Reply Last reply Nov 7, 2019, 9:29 AM Reply Quote 0
          • S Offline
            strawberry 3.141 Project Sponsor Module Developer @BigMan
            last edited by Nov 7, 2019, 9:03 AM

            @BigMan Since version 2.1.1 this is natively supported by MagicMirror²

            Enable ability to set configuration file by the environment variable called MM_CONFIG_FILE.

            To test it you can run MM_CONFIG_FILE=YOUR_PATH_TO_CONFIG_FILE npm start in the terminal.

            Please create a github issue if you need help, so I can keep track

            1 Reply Last reply Reply Quote 0
            • S Away
              sdetweil @sdetweil
              last edited by sdetweil Nov 7, 2019, 9:32 AM Nov 7, 2019, 9:29 AM

              @BigMan said in Create another config.js file:

              even easier!
              put all your configs into the config folder
              then just set which on to use

               #!/bin/bash
               # set my config 
               export MM_CONFIG_FILE=~/MagicMirror/config/config1.js
               # then call mm.sh
               exec ~/MagicMirror/installers/mm.sh
              

              thanks @strawberry-3-141

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 1
              • 1 / 1
              1 / 1
              • First post
                1/6
                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