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

Would it be possible to add TZ environment variables? #60

Open
jacol84 opened this issue Nov 30, 2023 · 1 comment
Open

Would it be possible to add TZ environment variables? #60

jacol84 opened this issue Nov 30, 2023 · 1 comment

Comments

@jacol84
Copy link

jacol84 commented Nov 30, 2023

I don't know how to set the time zone variable, an example that works is mariadb:latest, amazoncorretto:21

this is example docker-compose.yaml:

version: '3.8'
  server-a:
    container_name: server-a
    image: mendhak/http-https-echo
    environment:
      TZ: Europe/Warsaw
    ports:
      - "8091:8080"
@mendhak
Copy link
Owner

mendhak commented Dec 3, 2023

Looks like the morgan library only outputs UTC, based on this part of the README. That would explain why the TZ just gets ignored.

It's possible to use a third party library to format the date respecting the timezone, as seen in this article.

However, the date would need to match the Apache Common Log Format (CLF) format which is: "10/Oct/2000:13:55:36 +0000".

In the code currently the combined line format is:

:remote-addr - :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"

So I think it would require replacing the :date[clf] bit with a custom date token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants