How to specify OTA upload password outside platformio.ini?

Hi all,
tl;dr: how can I tell the OTA upload password for ESP32 without having it written in platformio.ini? Possibly from the command line?

I’m writing a PlatformIO project that allows for OTA updates to an ESP32 board. The updates are protected with a password.
I don’t want to write the password anywhere in any project files that are checked-in in VCS, so to prevent leaks if one day I’ll publish the project.
This means I cannot enter the password in platformio.ini as specified in the documentation; I’d rather have it in a separate file, but you cannot import other files in platformio.ini.
I’m OK with entering the password from the command line, but seems like I cannot specify options for the uploader, except --upload-port. I was hoping to have something like --upload-auth to no avail.

Kind regards,


A lot of ways:

  1. Environment variables — PlatformIO latest documentation
  2. Redirecting...
  3. Create external password.txt file and load it with Redirecting...
1 Like