fastiot.env package
Submodules
fastiot.env.env module
Module to hold basic environment variables
fastiot.env.env_basic module
- class fastiot.env.env_basic.BasicEnv[source]
Holds the default environment variables for the fastIoT framework.
Use the properties from
fastiot.env.fastiot_basic_env()
to read the values in an easy manner within your code.- property config_dir
- FASTIOT_CONFIG_DIR
Use to get the config dir, defaults to
/etc/fastiot
if not set.Usually, you don’t need to specify this variable manually, instead use config-dir entry on deployments. This way, this variable is automatically injected.
On automatic project setups everything should work out fine for you!
- property log_level: int
- FASTIOT_LOG_LEVEL
This environment variable is used to set the logging Level. Defaults to Info-Level (=20) Level for logging s. https://docs.python.org/3/library/logging.html#logging-levels
- property volume_dir: str
- FASTIOT_VOLUME_DIR
Use this variable to set the default mount dir for your project
- property service_id: str
- FASTIOT_SERVICE_ID
Use this variable to differentiate between multiple instances of the same service. The result is available as
self.service_id
. It is for example used to read a configuration file for each service withfastiot.util.read_yaml.read_config()
. See
- property log_dir: str
- property error_logfile: str
- class fastiot.env.env_basic.TestsEnv[source]
Environment variables for running tests
- property use_internal_hostnames: bool
- FASTIOT_USE_INTERNAL_HOSTNAMES
When starting containers inside another container, e.g. within a Jenkins running in a docker we cannot use
localhost
as hostname but need to use the docker container names as hast, e.g.nats
. Set this to True, to enable this method!
fastiot.env.env_broker module
- class fastiot.env.env_broker.BrokerEnv[source]
Environment variables for the message broker
Use the properties from
fastiot.env.FASTIOT_NATS_env()
to read the values in an easy manner within your code.
fastiot.env.env_constants_basic module
fastiot.env.env_constants_db module
fastiot.env.env_elasticdb module
fastiot.env.env_influxdb module
- class fastiot.env.env_influxdb.InfluxDBEnv[source]
Environment variables for influxdb
fastiot.cli.common.infrastructure_services.InfluxDBService
Use the properties from
fastiot.env.env.env_influxdb()
to read the values in an easy manner within your code. For connecting to InfluxDB, which is started with a token, you only need host, port and token. username and password are used for browser GUI.- property host: str
- FASTIOT_INFLUX_DB_HOST
Use to get/set the influx database host. This is usually either
influxdb
within the docker network orlocalhost
when developing against a local influxdb.
- property user: str
- FASTIOT_INFLUX_DB_USER
Use to get/set the influxdb username, default to ‘influx_db_admin’. This env var is only used for browser login, not for connecting from fastiot framework.
- property password: str
- FASTIOT_INFLUX_DB_PASSWORD
Use to get/set the influxdb password, default to ‘mf9ZXfeLKuaL3HL7w’. This env var is only used for browser login, not for connecting from fastiot framework. password for InfluxDB must be complex, otherwise InfluxDB won’t be started.
- property token: str
- FASTIOT_INFLUX_DB_TOKEN
InfluxDB API token with permission to query (read) buckets and create (write) authorizations for devices
fastiot.env.env_mariadb module
- class fastiot.env.env_mariadb.MariaDBEnv[source]
Environment variables for mariadb
fastiot.cli.common.infrastructure_services.MariaDBService
Use the properties from
fastiot.env.env.env_mariadb()
to read the values in an easy manner within your code. This will provide the environment variables needed forfastiot.db.mariadb_helper_fn.open_mariadb_connection_from_env()
- property host: str
- FASTIOT_MARIA_DB_HOST
Use to get/set the maria database host. This is usually either
mariadb
within the docker network orlocalhost
when developing against a local mariadb.
- property schema_fastiotlib: str
- FASTIOT_MARIA_DB_SCHEMA_FASTIOTLIB
Use to get/set the mariadb schema.
- property is_configured: bool
fastiot.env.env_mongodb module
- class fastiot.env.env_mongodb.MongoDBEnv[source]
Environment variables for mongodb
fastiot.cli.common.infrastructure_services.MongoDBService
Use the properties from
fastiot.env.env.env_mongodb()
to read the values in an easy manner within your code.- property host: str
- FASTIOT_MONGO_DB_HOST
Use to get/set the mongo database host. This is usually either
mongodb
within the docker network orlocalhost
when developing against a local mongodb.
- property auth_source: str | None
- FASTIOT_MONGO_DB_AUTH_SOURCE
Use to get/set the mongodb auth source, which is a database name which is needed for authentication.
- property mem_limit: str
- property is_configured: bool
Use to indicate if the mongodb is configured, it is not bound to any environment variable
fastiot.env.env_redis module
fastiot.env.env_timescaledb module
- class fastiot.env.env_timescaledb.TimeScaleDBEnv[source]
Environment variables for timescaledb
fastiot.cli.common.infrastructure_services.TimeScaleDBService
Use the properties from
fastiot.env.env.env_timescaledb()
to read the values in an easy manner within your code.- property host: str
- FASTIOT_TIME_SCALE_DB_HOST
Use to get/set the time scale database host. This is usually either
timescaledb
within the docker network orlocalhost
when developing against a local time_scale_db.
- property port: int
- FASTIOT_TIME_SCALE_DB_PORT
Use to get/set the time scale db port, defaults to 5432.
fastiot.env.helpers module
- fastiot.env.helpers.parse_bool_flag(env_var, default)[source]
Helper function for parsing flag env variables (returns true or false).
Please use this function for parsing boolean flags for unified behavior across fastiot. Please also note, that this function exists because a bool cast doesn’t cut it because bool(‘false’) is true why this function exists.
- Return type:
bool
- Parameters:
env_var (
str
) – The name of the env vardefault (
bool
) – The default flag if the env var doesn’t exist in os environment.
:return The flag, true or false