Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement TimeZone handling in Cli #23

Open
tobiasake opened this issue Aug 20, 2019 · 0 comments
Open

Implement TimeZone handling in Cli #23

tobiasake opened this issue Aug 20, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@tobiasake
Copy link
Contributor

tobiasake commented Aug 20, 2019

Description

To get correct timestamps in logs in containers, TZ variable need to be set to the timezone that the user is located and starts Easy2Use from.

One example of implementation in Easy2Use Cli is to update (easy2use root dir)/config-default.bash script with following content:
if [ $(uname -s) == Linux ]
then
# Getting the current computers timezone and apply it to all containers, so all logs and printouts timestamps bases on same timezone as the users computer/server timezone.
TZ_TEMP=$(cd /usr/share/zoneinfo && find * -type f -exec sh -c "diff -q /etc/localtime '{}' > /dev/null && echo {}" ;)
export TZ=$(echo $TZ_TEMP | head -n 1)
# TODO: How to get timezone when executed from windowns ? Currently when executed on windows, containers uses a default timezone.
# NOTE!: All containers need to be seeded with environment variable 'TZ' to apply timezone to the conatiners.
else
# If it is not possible to get the users local timezone, then timezone is set to default timezone UTC.
# For windows TZ timezone need to be extracted from somewhere.
# Or windows users can maybe set timezone manual by a cli flag?
export TZ="UTC"
fi

And inject that variable to each container that is started in each bundle.

Motivation

Exemplification

Benefits

Log timestamps is set to the user local timezone.

Possible Drawbacks

@emichaf emichaf added the enhancement New feature or request label Aug 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants