is there a best practice to avoid clear text password stored in Github like using a search-replace with a hidden file? I could add a Wifi manager but this is a little oversized. But perhaps I will simply switch to it.
This is stored in the code and I do not like to exchange it with placeholders manually on upload to Github...working with VS Code and Platform.IO.
Well, the best practice is to not store passwords in code to begin with! You could have an interface (e.g., serial port) to manually enter them the first time the device starts up and save to EEPROM/Flash.
That said, for Wi-Fi passwords, what's the harm? Someone who knows your address from your github repo wardriving in front of your house? It's not like a banking, or even email, password.
put your credentials in a separate file/library and don't publish that "library"
In your example sketches on Github you just include that credentials.h
#include <credentials.h> // if you have an external file with your credentials you can use it - remove before upload
#ifndef STASSID // either use an external .h file containing STASSID and STAPSK - or
// // add defines to your boards - or
#define STASSID "your-ssid" // ... modify these line to your SSID
#define STAPSK "your-password" // ... and set your WIFI password
#endif
const char* ssid = STASSID;
const char* password = STAPSK;
others can either use their own credentials.h or just hardcode it in their local copy.
That I am looking for...but as a best practice for Arduino or better VS Code development with Arduino/platform.io. I thought of installing a WifiManager (temporary AP) but like to know this in general. Found many repositories with Wifi credentials included so perhaps someone published its banking password without knowing...(my is different from Wifi ).