Skip to content

Secrets Cleanup: A #2989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2025
Merged

Secrets Cleanup: A #2989

merged 1 commit into from
Mar 12, 2025

Conversation

justmobilize
Copy link
Contributor

@justmobilize justmobilize commented Mar 7, 2025

Round of removing secrets from learn guides

Comment on lines +20 to +33
# Get WiFi details and Adafruit IO keys, ensure these are setup in settings.toml
# (visit io.adafruit.com if you need to create an account, or if you need your Adafruit IO key.)
ssid = getenv("CIRCUITPY_WIFI_SSID")
password = getenv("CIRCUITPY_WIFI_PASSWORD")
aio_username = getenv("ADAFRUIT_AIO_USERNAME")
aio_key = getenv("ADAFRUIT_AIO_KEY")

if None in [ssid, password, aio_username, aio_key]:
raise RuntimeError(
"WiFi and Adafruit IO settings are kept in settings.toml, "
"please add them there. The settings file must contain "
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
"'ADAFRUIT_AIO_USERNAME' and 'ADAFRUIT_AIO_KEY' at a minimum."
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New standard wifi+aio block

Comment on lines +93 to +95
wifi.radio.connect(ssid, password)
print(f"Connected to {ssid}!")
print(f"IP: {wifi.radio.ipv4_address}")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

standard cleanup

Comment on lines -93 to -98
# Set your Adafruit IO Username and Key in secrets.py
# (visit io.adafruit.com if you need to create an account,
# or if you need your Adafruit IO key.)
aio_username = secrets["aio_username"]
aio_key = secrets["aio_key"]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

common to have this after the fact, now up top

from adafruit_lc709203f import LC709203F, PackSize
from adafruit_bme280 import basic as adafruit_bme280
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pylint

Comment on lines +18 to +28
# Get WiFi details, ensure these are setup in settings.toml
ssid = getenv("CIRCUITPY_WIFI_SSID")
password = getenv("CIRCUITPY_WIFI_PASSWORD")

if None in [ssid, password]:
raise RuntimeError(
"WiFi settings are kept in settings.toml, "
"please add them there. The settings file must contain "
"'CIRCUITPY_WIFI_SSID', 'CIRCUITPY_WIFI_PASSWORD', "
"at a minimum."
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new standard wifi only block

Comment on lines +50 to +51
status_pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2)
wifi = adafruit_esp32spi_wifimanager.WiFiManager(esp, ssid, password, status_pixel=status_pixel)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

standard update to WiFiManager, status_pixel is a named arg only, Dan wanted the arg and var to match

@@ -67,10 +76,10 @@

### Feeds ###
# Set up a feed named Relay for subscribing to the relay feed on Adafruit IO
feed_relay = secrets["aio_username"] + "/feeds/relay"
feed_relay = f"{aio_username}/feeds/relay"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some f-string cleanup

Comment on lines +18 to +19
ssid = os.getenv("CIRCUITPY_WIFI_SSID")
password = os.getenv("CIRCUITPY_WIFI_PASSWORD")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os is already imported for other reasons, so left it like that

@justmobilize
Copy link
Contributor Author

@FoamyGuy, here is PR number 1. Let's use this to discuss any change you would like to do in the format. I tried to be verbose in the comments on this one for the first time I did something, so it's easy to review the next ones.

I added check boxes to each main group, so they could be checked off as updated (let me know if this makes it easy)

@justmobilize justmobilize marked this pull request as ready for review March 7, 2025 21:52
Copy link
Collaborator

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code changes look good to me.

We just need to coordinate merging this with updating the relevant guide pages to happen as close to same time as possible.

@FoamyGuy
Copy link
Collaborator

And, thank you for the checkmarks in the comment! Yes that will make it easier to get things updated.

@justmobilize
Copy link
Contributor Author

Sounds good. I'll start prepping the next one!

@FoamyGuy
Copy link
Collaborator

I've updated the guides for the changes made in this PR.

@FoamyGuy FoamyGuy merged commit c322fbd into adafruit:main Mar 12, 2025
4 checks passed
@justmobilize justmobilize deleted the secrets-cleanup-a branch March 12, 2025 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants