-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feature: readme * fix: git actions rmq settings * fix: delete previos container via docker stop * feature: ApplicationStartup PostConstruct Instant * fix: build and push first * fix: docker image name * fix: gradlew build * fix: build in local * fix: remove docker build from script
- Loading branch information
Showing
4 changed files
with
43 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<p align="center"> | ||
<img src="https://github.com/user-attachments/assets/a00863d4-83f6-4310-a2ba-f5d94b955ae1"> | ||
</br> </br> | ||
<b>two friends gathering</b> | ||
</p> |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/example/swiftgathering_server/config/ApplicationStartup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.example.swiftgathering_server.config; | ||
|
||
import lombok.Getter; | ||
import org.springframework.stereotype.Component; | ||
|
||
import jakarta.annotation.PostConstruct; | ||
import java.time.Instant; | ||
|
||
@Component | ||
public class ApplicationStartup { | ||
@Getter | ||
private static Instant startTime; | ||
|
||
@PostConstruct | ||
public void onStartup() { | ||
startTime = Instant.now(); | ||
} | ||
} |
15 changes: 12 additions & 3 deletions
15
src/main/java/com/example/swiftgathering_server/controller/HealthController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,24 @@ | ||
package com.example.swiftgathering_server.controller; | ||
|
||
import com.example.swiftgathering_server.config.ApplicationStartup; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.time.Instant; | ||
import java.time.ZoneId; | ||
import java.time.ZonedDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
@Controller | ||
@RequestMapping("/health") | ||
public class HealthController { | ||
@GetMapping | ||
public ResponseEntity<String> checkHealth() { | ||
return ResponseEntity | ||
.ok("v1.0.6"); | ||
Instant bootTime = ApplicationStartup.getStartTime(); | ||
ZonedDateTime bootTimeKST = bootTime.atZone(ZoneId.of("Asia/Seoul")); | ||
String bootTimeFormatted = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss z").format(bootTimeKST); | ||
String response = String.format("boot time: %s", bootTimeFormatted); | ||
return ResponseEntity.ok(response); | ||
} | ||
} | ||
} |