Is it possible to use build_vars in config_schema?

I would like to build firmware with preconfigured Wifi provided on build time. It is possible to use build vars to achieve this? Following setup doesn’t work:

config_schema:
  - ["wifi.sta.enable", true]
  - ["wifi.sta.ssid", build_vars.WIFI_SSID]
  - ["wifi.sta.pass", build_vars.WIFI_PASS]

Could you clarify please - are you trying to pass name/pass as a command line parameters for the mos build command?
My understanding is that you don’t like to hardcode the strings into the mos.yml file.

Right. I would like to specify SSID and password in the commandline on build.

Apparently that’s not possible at this moment.

The ugly workaround would be to temporarily replace mos.yml with the hardcoded credentials, then restore after build completes.

OK. Thank you for the info.

or modify the yml file with conditionals:

conds:

  • when: build_vars.WIFI == “provisioned”
    apply:
    config_schema:

    • [“wifi.sta.enable”, true]
    • [“wifi.ap.enable”, true]
    • [“wifi.sta.ssid”, “your ssid”]
    • [“wifi.sta.pass”, “your password”]
    • [“wifi.sta1.ssid”, “”]
    • [“wifi.sta1.pass”, “”]
    • [“wifi.sta2.ssid”, “”]
    • [“wifi.sta2.pass”, “”]
  • when: build_vars.WIFI == “notprovisioned”
    apply:
    config_schema:

    • [“wifi.sta.enable”, false]
    • [“wifi.ap.enable”, true]
    • [“wifi.sta.ssid”, “”]
    • [“wifi.sta.pass”, “”]
    • [“wifi.sta1.ssid”, “”]
    • [“wifi.sta1.pass”, “”]
    • [“wifi.sta2.ssid”, “”]
    • [“wifi.sta2.pass”, “”]

build_vars:
WIFI: provisioned

@majorninth thanks, we are using them already, but config filewould be pretty long to include all possible SSIDs and passwords :wink:

Any news on that topic?
It would be really great to have such features.

Why not write little build script that writes your mos.yml file then starts the build process?