Read the statement by Michael Teeuw here.
Compliments.json absolute or relative and proper path
-
I’ve read the other posts, not sure I found all of them, and I"m still having a little problem. I can’t seem to get the right path to my compliments.json file. I have to admit I’m a bit rusty on my linux and doing things with the command path.
I notice the magic mirror config.js has base path is “/”
I’m going to assume that is the magic mirror directory itself and all things are supposed to run relative to that.here is my issue:
I have the compliments.json located in the mirror’s config folder (I figured that would be the safest place to put it so it won’t get overwritten if I update anything. )
so in the config.js in the modules section for compliments I tried
remoteFile: ‘/mounts/config/compliments.json’
remoteFile: ‘/config/compliments.json’
remoteFile: ‘compliments.json’
remoteFile: ‘/home/pi/magicmirror/mounts/config/compliments.json’none of those paths worked…
so please help me out. I’m guessing I need a relative path instead of absolute, or I’m adding or not adding a slash or something.(I’m not breaking the module, so I think I"m just not getting to my compliments.json at all and the compliments module is just defaulting)
-
@kayakbabe Well, I haven’t played with Docker ever. I also used the #MagicMirrorOS install method because it sounded super fast and easy. That said, I discovered some things about Docker. .And in the process discovered that the compliments.json I created was being erased/deleted/disappeared every time I stopped and started the raspberry pi.
For those who don’t know anything about docker… it’s kind of like a software publishing system where make sure your production server always has the files it is supposed to have and you can throw copies of that production server out super quick. This is a super lame description… but it was the reason I couldn’t solve my path issue. Because the “copy” of MagicMirror didn’t have a compliments.json in any of the folders that I tried to put it, that compliments.json was being removed every time I started up magic mirror from that Docker instance.
So in short I redid my sd card with a manual install and didn’t use any of the alternative methods (no docker image).
I also am able to set my compliments remote file to
remoteFile: “…/…/…/config/compliments.json”
and it works great.and I can now put it anywhere I want on the pi so long as the relative paths are correct. I can keep it from being replaced if I want to update the modules.
-
-
it is a good idea to put the
compliments.json
beside theconfig.js
.In the
config.js
you have to useremoteFile: "../../../config/compliments.json"`
-
@karsten13 that is exactly what I did. I like having it outside the config.js so the config.js doesn’t grow to be a huge file. And so if I mess up when I add to the compliments.json, I won’t break the entire mirror.
I’m adding a whole lot of birthdays and lots of family specific dates. I like having the remoteFile setting so I can keep this data out of config.js.
-
@kayakbabe you Can put you file in to default/compliments
And insert this to config.js{
module: ‘compliments’,
position: ‘bottom_bar’,
config: {
remoteFile: ‘youfiles.compliments.json’
}
},