Skip to content

Remove secrets usage #28

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 2 commits into from
Feb 25, 2025
Merged

Conversation

justmobilize
Copy link
Collaborator

@justmobilize justmobilize commented Feb 24, 2025

Remove usage of secrets and more:

  1. change from using secrets.py to os.getenv
  2. switch from ESPSPI_WiFiManager to WiFiManager
  3. update pool, ssl_context setting to use adafruit_connection_manager like all the other examples

@justmobilize justmobilize marked this pull request as ready for review February 24, 2025 23:30
@justmobilize
Copy link
Collaborator Author

@dhalbert there are 6 PRs that use ESPSPI_WiFiManager and are the largest user of secrets in examples. This is 1 of them

Comment on lines 13 to 20
# file or commit it into Git or other source control. The file dictionary should have the
# following settings:
# CIRCUITPY_WIFI_SSID - Your WiFi ssid
# CIRCUITPY_WIFI_PASSWORD - Your WiFi password
# device_cert_path - Path to the Device Certificate from AWS IoT ("<THING_NAME>.cert.pem")
# device_key_path - Path to the RSA Private Key from AWS IoT ("<THING_NAME>.private.key")
# broker - The endpoint for the AWS IoT broker ("<PREFIX>.iot.<REGION>.amazonaws.com")
# client_id - The client id. Your device's Policy needs to allow this client ("basicPubSub")
Copy link
Contributor

@dhalbert dhalbert Feb 25, 2025

Choose a reason for hiding this comment

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

Leave out the word "dictionary". You might want to use a format like

... The file should contain the following settings:
CIRCUITPY_WIFI_SSID="your WiFi ssid"
CIRCUITPY_WIFI_PASSWORD="your WiFi password"
...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Would you then do:

device_cert_path="Path to the Device Certificate from AWS IoT (<THING_NAME>.cert.pem)"

?

Copy link
Contributor

Choose a reason for hiding this comment

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

How about:

device_cert_path="THING_NAME.cert.pem"   # Path to the Device Certificate from AWS IoT

or, maybe more readable:

# Path to the Device Certificate from AWS IoT
device_cert_path="THING_NAME.cert.pem" 

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay, I'll move it into triple quotes so it can be copied

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@dhalbert updated here: 767339b

Comment on lines +14 to +21
"""
CIRCUITPY_WIFI_SSID="Your WiFi ssid"
CIRCUITPY_WIFI_PASSWORD="Your WiFi password"
device_cert_path="<THING_NAME>.cert.pem" # Path to the Device Certificate from AWS IoT
device_key_path="<THING_NAME>.private.key" # Path to the RSA Private Key from AWS IoT
broker="<PREFIX>.iot.<REGION>.amazonaws.com" # The endpoint for the AWS IoT broker
client_id="client_id" # The client id. Your device's Policy needs to allow this client
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

This is good but I don't understand why you put it in triple quotes instead of using comments.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So you can do a direct copy and place it in your settings.toml. Happy to change it back to comments if you prefer

Copy link
Contributor

Choose a reason for hiding this comment

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

that's a good idea!

@dhalbert dhalbert merged commit 359fb50 into adafruit:main Feb 25, 2025
1 check passed
@justmobilize justmobilize deleted the remove-secrets-usage branch February 25, 2025 02:54
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Feb 26, 2025
Updating https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI to 9.0.1 from 9.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#217 from dhalbert/json-url

Updating https://github.com/adafruit/Adafruit_CircuitPython_AWS_IOT to 3.0.0 from 2.0.21:
  > Merge pull request adafruit/Adafruit_CircuitPython_AWS_IOT#28 from justmobilize/remove-secrets-usage

Updating https://github.com/adafruit/Adafruit_CircuitPython_GC_IOT_Core to 4.0.0 from 3.2.13:
  > Merge pull request adafruit/Adafruit_CircuitPython_GC_IOT_Core#30 from justmobilize/remove-secrets-usage

Updating https://github.com/adafruit/Adafruit_CircuitPython_AzureIoT to 3.0.0 from 2.6.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_AzureIoT#66 from justmobilize/remove-secrets-usage

Updating https://github.com/adafruit/Adafruit_CircuitPython_Dash_Dis to 3.0.0 from 2.1.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_Dash_Dis#20 from justmobilize/remove-secrets-usage

Updating https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_Layout to 2.2.2 from 2.2.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_Layout#97 from FoamyGuy/use_ruff_remove_8x_compat

Updating https://github.com/adafruit/Adafruit_CircuitPython_WSGI to 3.0.0 from 2.0.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_WSGI#23 from justmobilize/remove-secrets-usage
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