timelink.mhk package

Subpackages

Submodules

timelink.mhk.utilities module

Utilities for interaction with and MHK installation.

MHK is the name of Java Webapp that preceded Timelink.

  1. Joaquim Carvalho, 2021. MIT Licence.

timelink.mhk.utilities.get_db_pwd() str[source]

Get the password of the database from the MHK environment

timelink.mhk.utilities.get_dbnames()[source]

Get the names of MHK databases in MySQL

A search is made in the MySQL server running in the local host port 3307

timelink.mhk.utilities.get_env_as_dict(filename: str) dict[source]

Reads environment variables from a file and return a SafeConfig object

Rationale: SafeConfig parser requires :param filename: Name of a file :return:

timelink.mhk.utilities.get_mhk_app_env() Type[str | None][source]

Get the mhk app environment variables from mhk-home/app/.env

The .env filed contains information used by docker to create the MHK application and some running options, like header color and docker image tags used for updates.

The .env file is created by the MHK installation process. Its contents can be changed my mhk manager commands.

timelink.mhk.utilities.get_mhk_db_pwd()[source]

Get the password of the database from the MHK environment

timelink.mhk.utilities.get_mhk_env() Type[str | None][source]

Get the MHK environment variables from ~/.mhk

The .mhk file contains the path for the mhk-home of the current user. It is created by the MHK install process.

timelink.mhk.utilities.is_mhk_installed() bool[source]

Returns true if a MHK instalation is found

Checks the existence of ~/.mhk

timelink.mhk.utilities.remove_quotes(original)[source]

Removes quotes from quoted values in env variables See https://stackoverflow.com/a/50772706 :param original: dict with env variables :return: copy of the dict with the values unquoted