Skip to content
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

Deprecate settings.yml, and document usage #1692

Merged
merged 2 commits into from
Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions app/update/settings.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
"""Manages a TinyPilot update settings file.

TinyPilot currently manages some of its settings in a database and some of its
settings in a YAML settings file. This module is a wrapper around the YAML
settings file that allows TinyPilot code to modify it cleanly.
This module is a wrapper around the YAML settings file (settings.yml) that
allows TinyPilot code to modify it cleanly.

Typical usage example:

settings = update_settings.load()
settings.ustreamer_desired_fps = 15
update_settings.save(settings)

Note that we consider the use of settings.yml to be deprecated nowadays. The
default place to store settings and configuration is the SQlite database. We
should only add new properties to settings.yml in exceptional cases, such as:
- Settings that are supposed to be manually overridden by users
- Settings that are closely related to already existing legacy settings

Historically, settings.yml was used as we relied on Ansible to manage and
update the device system state. The canonical way for configuration in Ansible
is files in YAML format, so a YAML file was an obvious choice here. This
wrapper module resides in the update package, since settings.yml was only
processed throughout the update process initially. Over time, we also added a
few other settings, which are independent of the update context.
As of mid 2023, we have finished migrating away from Ansible, so there is no
hard requirement for us to continue using the settings.yml file, except for
backwards compatibility with existing TinyPilot installations.
"""

import yaml
Expand Down