mongoose-os / mos

The Mongoose OS Command Line Tool - https://mongoose-os.com/docs/mongoose-os/quickstart/setup.md
Other
45 stars 31 forks source link

Local override for mos.yml #28

Open Harvie opened 4 years ago

Harvie commented 4 years ago

We have mos.yml in our repository, where multiple developers collaborate. I have some changes that i want to store and apply only on my development setup. I think it would be nice to have something like mos.local.yml which i would be able to put in .gitignore and it would eventualy override any upstream settings from mos.yml. So i can still pull latest mos.yml from git without having to worry that my local changes will be overwriten by upstream or commited to repository.

rojer commented 4 years ago

you can use mos_PLATFORM.yml for that, e.g. mos_esp32.yml, etc.

out of curiosity, what's different in your mos.yml? what are you overriding?

Harvie commented 4 years ago

out of curiosity, what's different in your mos.yml? what are you overriding?

wifi credentials and azure cloud pairing keys. so when i flash the device with new development firmware i don't have to go throught the pairing process each time and it gets connected right away. while the clean repository will build firmware that is not paired to particular wifi network and azure account, so the end user will be able to pair it.

rojer commented 4 years ago

so you're overriding config values, correct? in that case, better way to do it (and one i use daily) is to use confX.json. i use conf5.json which i put in the fs directory and where it gets picked up by the firmware build (assuming it's listed in the "filesystem" section in mos.yml), and i put my overrides there. the file is not checked in. here's an example of fs/conf5.json from one of my projects:

{
  "device": {
    "Xmac": "88:da:1a:11:11:11"
  },
  "bt": {
    "keep_enabled": true
  },
  "wifi": {
    "ap": {
      "enable": false,
      "ssid": "Mongoose_000000",
      "pass": "Mongoose"
    },
    "Xsta": {
      "enable": true,
      "ssid": "Cesanta",
      "pass": "XXXX"
    },
    "Xsta": {
      "enable": true,
      "ssid": "zLocal",
      "pass": "XXX"
    },
    "sta": {
      "enable": true,
      "ssid": "Over_9000_Internets",
      "pass": "XXX"
    },
    "sta_connect_timeout": 10
  },
  "debug": {
    "Xlevel": 3,
    "Xmbedtls_level": 4,
    "udp_log_addr": "192.168.11.30:1234",
    "udp_log_level": 4,
    "Xfile_level": "mg_mqtt=3,mg_net=3,mg_lwip_net_if.c:175=4,mg_lwip_net_if.c:528=4"
  }
}