diff --git a/config.yml b/config.yml index d7e8c02..c52a533 100644 --- a/config.yml +++ b/config.yml @@ -15,7 +15,7 @@ report: - "Pause-Dauer" users: - dsommer: - password: "$Velvet90" + user: + password: "myS00perS3cr3tPa$$word" debug: true \ No newline at end of file diff --git a/config/config.yml b/config/config.yml new file mode 100644 index 0000000..d3b9a8e --- /dev/null +++ b/config/config.yml @@ -0,0 +1,21 @@ +database: /home/velvettear/worklog/worklog.sqlite + +server: + listen: "0.0.0.0" + port: 5000 + +report: + headers: + - "Datum" + - "Arbeitstag-Beginn" + - "Arbeitstag-Ende" + - "Arbeitstag-Dauer" + - "Pause-Beginn" + - "Pause-Ende" + - "Pause-Dauer" + +users: + dsommer: + password: "myS00perS3cr3tPa$$word" + +debug: true \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..5215322 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: "3" + +services: + worklog: + build: ./docker + container_name: worklog + restart: unless-stopped + volumes: + - ./config:/root/.config/worklog + ports: + - 5000:5000 diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..a475170 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,29 @@ +FROM alpine:3.17 + +LABEL version="1.0.0" \ + author="Daniel Sommer " \ + license="MIT" + +MAINTAINER Daniel Sommer + +ENV LANG=C.UTF-8 + +RUN apk upgrade --no-cache --progress \ + && apk add --no-cache --progress \ + tzdata \ + git \ + go \ + && ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime \ + && echo "Europe/Berlin" > /etc/timezone \ + && git clone https://git.velvettear.de/velvettear/worklog.git /tmp/worklog \ + && cd /tmp/worklog \ + && go build \ + && mv /tmp/worklog/worklog /usr/bin/worklog \ + && rm -rf /tmp/worklog \ + && apk del --no-cache --progress \ + git \ + go + +EXPOSE 5000 + +ENTRYPOINT ["worklog"] \ No newline at end of file diff --git a/internal/workday/workday.go b/internal/workday/workday.go index c857ec6..b978616 100644 --- a/internal/workday/workday.go +++ b/internal/workday/workday.go @@ -87,9 +87,6 @@ func GetToday(user string) (Workday, error) { workday.Start = firstTimestamp.Start workday.Stop = firstTimestamp.End workday.Duration = workday.Stop.Sub(workday.Start) - if workday.isOpen() { - return workday, nil - } currentTimestamp := database.GetLastTimestamp(user, time.Now()) workday.Stop = currentTimestamp.End if workday.Stop == tools.ZeroDate {