Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mschout/gitlab-toggl-timer-api
Microservice to start my toggl timer from a gitlabl issue page
https://github.com/mschout/gitlab-toggl-timer-api
Last synced: about 1 month ago
JSON representation
Microservice to start my toggl timer from a gitlabl issue page
- Host: GitHub
- URL: https://github.com/mschout/gitlab-toggl-timer-api
- Owner: mschout
- Created: 2024-05-30T23:42:51.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-05-31T17:36:08.000Z (7 months ago)
- Last Synced: 2024-06-01T17:54:15.921Z (7 months ago)
- Language: Java
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# What Is This
This is a microservice that can take a URL for a GitLab issue page, figures out the issue number, and starts your Toggl
timer using a project that has a name like: `12345 - Issue Title`. Where the gitlab issue number is `12345`, and the
title of the issue in gitlab is `Issue Title`.If no such project exists in toggl that starts with `12345 -`, then a new toggle project will be created automatically.
This can be paird with a bookmarklet to make it easy to start your toggl timer from a gitlab issue page. This is
possibly not useful to anyone except myself.# Requirements
Docker, Docker Compose.
If you want to compile this outside of docker you need Java 22.
# How to run it
1. Clone the repo
2. Build the docker image with `./scripts/build-docker-image`
3. Define the necessary environment variables for your toggl and gitlab accounts (see below)
4. Run `docker compose up -d`The API will be available at http://localhost:8080 and the Swagger UI is available at
http://localhost:8080/swagger-ui.html# Environment Variables
You must set the following environment variables for `docker compose up` to work:
- `GITLAB_ACCESS_TOKEN` - Your GitLab personal access token
- `TOGGL_API_KEY` - Your Toggl API key# Bookmarklets
In all bookmarks, you must use your own Toggl `workspaceId` and `clientId`
values.The following bookmarklet will create a toggle project for the current gitlab
issue page, or return the existing project if it already exists:```
javascript:(function(){
window.open("http://localhost:8080/timer/create-project?issueUrl="
+ encodeURIComponent(window.location.href)
+ "&workspaceId=12345&clientId=12345",
"_blank");
})();
```The following bookmarklet will start a timer for the current gitlab issue page, creating the issue on toggl if
necessary:```
javascript:(function(){
window.open("http://localhost:8080/timer/start?issueUrl="
+ encodeURIComponent(window.location.href)
+ "&workspaceId=12345&clientId=12345",
"_blank");
})();
```# Dev Notes
This project uses AspectJ, mainly so we can use things like `@Cacheable` on
internal self-invocations. In IntelliJ, you will likely get compile failures
unless you do do the following:- Open File > Project Structure
- In the dialog that opens, go to Modules > AspectJ
- Under Compiler tick the box for "Post-compile weave mode". This ensures
lombok runs before the AspectJ compiler