Skip to content

Commit

Permalink
Make dependency on darkmode optional
Browse files Browse the repository at this point in the history
  • Loading branch information
foodelevator committed May 10, 2024
1 parent b79f217 commit 9cad895
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ services:
LOGIN_FRONTEND_URL: http://localhost:7002/
LOGIN_API_URL: http://login:7002/
LOGIN_KEY: asdf
DARKMODE_URL: false
ports:
- "3000:8080"
login:
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/se/datasektionen/calypso/Darkmode.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ public Darkmode(Config config) {
}

public boolean getCurrent() {
var response = new RestTemplate()
.exchange(config.getDarkmodeUrl(), HttpMethod.GET, new HttpEntity<>(null, null), boolean.class)
var url = config.getDarkmodeUrl();
if (url == "true") return true;
if (url == "false") return false;
return new RestTemplate()
.exchange(url, HttpMethod.GET, new HttpEntity<>(null, null), boolean.class)
.getBody();
return response;
}
}

0 comments on commit 9cad895

Please sign in to comment.