engforge.env_var.EnvVariable

class EnvVariable(secret_var_name, type_conv=None, default=None, obscure=False, fail_on_missing=False, desc=None, dontovrride=False)[source]

Bases: LoggingMixin

A method to wrap SECRETS and in application with a way to get the value using self.secret Do not store values from self.secret to ensure security

You can override the secret with _override

pass arguments to SecretVariable to have it look up information at runtime from envargs, but not store it in memory. :type secret_var_name: :param secret_var_name: the enviornmental variable :type type_conv: :param type_conv: the data from env vars will be converted with this function :type default: :param default: the value to use if the secret_var_name doesn’t exist in enviornmental variables :type obscure: :param obscure: default True, will prevent the result being printed by str(self) :type fail_on_missing: :param fail_on_missing: if the secret env variable is not found, and default is None :type desc: Optional[str] :param desc: a description of the purpose of the variable

Methods

add_fields

Overwrite this to modify logging fields

change_all_log_lvl

critical

A routine to communicate to the root of the server network that there is an issue

debug

Writes at a low level to the log file.

error

Writes to log as a error

extract_message

filter

This acts as the interface for logging.Filter Don't overwrite this, use add_fields instead.

info

Writes to log but with info category, these are important typically and inform about progress of process in general

installSTDLogger

We only want std logging to start

load_env_vars

message_with_identiy

converts to color and string via the termcolor library :type message: str :param message: a string convertable entity :type color: :param color: a color in [grey,red,green,yellow,blue,magenta,cyan,white]

msg

Writes to log.

print_env_vars

prints env vars in memory

remove

removes this secret from the record

resetLog

reset log

resetSystemLogs

resets log on all internal instance LoggingMixins

slack_notification

warning

Writes to log as a warning

Attributes

default

desc

identity

in_env

log_fmt

log_level

log_on

logger

obscure

obscured_name

secret

slack_webhook_url

type_conv

var_name

fail_on_missing

Parameters:
  • type_conv (Any)

  • default (Any)

  • obscure (bool)

  • fail_on_missing (bool)

  • desc (str)

add_fields(record)

Overwrite this to modify logging fields

critical(*args)

A routine to communicate to the root of the server network that there is an issue

debug(*args)

Writes at a low level to the log file… usually this should be detailed messages about what exactly is going on

error(error, msg='')

Writes to log as a error

filter(record)

This acts as the interface for logging.Filter Don’t overwrite this, use add_fields instead.

info(*args)

Writes to log but with info category, these are important typically and inform about progress of process in general

installSTDLogger()

We only want std logging to start

message_with_identiy(message, color=None)

converts to color and string via the termcolor library :type message: str :param message: a string convertable entity :type color: :param color: a color in [grey,red,green,yellow,blue,magenta,cyan,white]

Parameters:

message (str)

msg(*args, lvl=5)

Writes to log… this should be for raw data or something… least priorty

classmethod print_env_vars()[source]

prints env vars in memory

remove()[source]

removes this secret from the record

resetLog()

reset log

resetSystemLogs(reseted=None)

resets log on all internal instance LoggingMixins

warning(*args)

Writes to log as a warning