fastiot.env.env module¶
Module to hold basic environment variables
- fastiot.env.env.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
- class fastiot.env.env.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.TestsEnv[source]¶
Environment variables for running tests
- property use_internal_hostnames: bool¶
- class fastiot.env.env.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.
- class fastiot.env.env.MongoDBEnv[source]¶
Environment variables for mongodb MongoDB Service
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
- class fastiot.env.env.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
- class fastiot.env.env.MariaDBEnv[source]¶
Environment variables for mariadb MariaDB Service
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¶
- class fastiot.env.env.InfluxDBEnv[source]¶
Environment variables for influxdb InfluxDB Service
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
- class fastiot.env.env.TimeScaleDBEnv[source]¶
Environment variables for timescaledb TimeScaleDB Service
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.