Device Configuration Support

To keep things simple, this template uses a text file in Tom's Obvious Minimal Language format ./config.toml. The Config class provides read-only access to the various config options for this device that are in ./config.toml.

Of course you can alter these config items, making changes to the items in ./config.toml to accommodate your config needs.

Device-Specific Settings

In the sample config.toml, the [device] section contain settings for the Rotator sample. This is where you can put your device’s settings. The items that are there need to be reflected in the Config class to provide named access to your driver’s code.

Alternate Location of config.toml

The Config class provides support for the config.toml file to be located at /alpyca/config.toml (note the rooted path). This makes it possible to store sensitive information for a specific driver installation within (e.g.) a Docker container and avoid keeping sensitive information in the driver repository. Any setting will first be retried from /alpyca/config.toml and if not found there, it will look in ./config.toml.

Config class

class config.Config

Device configuration. For docker based installation specific configuration, will first look for /alpyca/config.toml and if exists, any setting there will override those in ./config.toml (the default settings file).

addr_family: str = 'ipv4'
can_reverse: bool = True
ip_address: str = ''
location: str = 'Anywhere on Earth'
log_level: int = 20
log_to_stdout: str = False
max_size_mb: int = 5
num_keep_logs: int = 10
port: int = 5555
step_size: float = 1.0
steps_per_sec: int = 6
sync_write_connected: bool = True
verbose_driver_exceptions: bool = True