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 with fastiot.util.config_helper.read_config(). See Configuration for a service for more information.

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.

property host: str
FASTIOT_NATS_HOST

Use to get/set the broker host. This is usually either nats within the docker network or localhost when developing against a local broker.

property port: int
FASTIOT_NATS_PORT

Use to get/set the broker port, defaults to 4222.

property default_timeout: float
FASTIOT_NATS_DEFAULT_TIMEOUT

Use to get/set the broker timeout in seconds, defaults to 30.

fastiot.env.env_constants_basic module

fastiot.env.env_constants_db 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 or localhost when developing against a local influxdb.

property port: int
FASTIOT_INFLUX_DB_PORT

Use to get/set the influxdb port, defaults to 8086.

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

property organisation: str
FASTIOT_INFLUX_DB_ORG

Set the organisation for InfluxDB, defaults to FastIoT if not set.

property bucket: str
FASTIOT_INFLUX_DB_BUCKET

Set the bucket for InfluxDB to store data, defaults to things if not set.

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 for fastiot.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 or localhost when developing against a local mariadb.

property port: int
FASTIOT_MARIA_DB_PORT

Use to get/set the mariadb port, defaults to 3306.

property user: str
FASTIOT_MARIA_DB_USER

Use to get/set the mariadb user.

property password: str | None
FASTIOT_MARIA_DB_PASSWORD

Use to get/set the mariadb password.

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 or localhost when developing against a local mongodb.

property port: int
FASTIOT_MONGO_DB_PORT

Use to get/set the mongodb port, defaults to 27017.

property user: str | None
FASTIOT_MONGO_DB_USER

Use to get/set the mongodb user.

property password: str | None
FASTIOT_MONGO_DB_PASSWORD

Use to get/set the mongodb password.

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 name: str
FASTIOT_MONGO_DB_NAME

Use to get/set the name of mongodb database.

property mem_limit: str
property is_configured: bool

Use to indicate if the mongodb is configured, it is not bound to any environment variable

class fastiot.env.env_mongodb.MongoDBColConstants[source]

Environment variables for mongodb collection

Use the properties from fastiot.env.env_mongodb_cols() to read the values in an easy manner within your code.

property time_series: str

..envvar:: FASTIOT_MONGO_DB_TIME_SERIES_COL

fastiot.env.env_redis module

class fastiot.env.env_redis.RedisEnv[source]

Environment variables to connect to the Redis Server

property host: str
FASTIOT_REDIS_HOST

Use to get/set the redis database host. This is usually either redis within the docker network or localhost when developing against a local redis server.

property port: int
FASTIOT_REDIS_PORT

Use to get/set the Redis port, defaults to 6379.

property password: str | None
FASTIOT_REDIS_PASSWORD

Use to get/set the Redis password.

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 or localhost 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.

property user: str | None
FASTIOT_TIME_SCALE_DB_USER

Use to get/set the TimeScaleDB user.

property password: str | None
FASTIOT_TIME_SCALE_DB_PASSWORD

Use to get/set the time scale db password.

property database: str
FASTIOT_TIME_SCALE_DB_DATABASE

Use to get/set the time scale db database.

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.

Parameters:
  • env_var (str) – The name of the env var

  • default (bool) – The default flag if the env var doesn’t exist in os environment.

Return type:

bool

Returns:

The flag, true or false