-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to provide commit hash and version in docker solarthing
- Loading branch information
1 parent
291c29c
commit 0b5dc50
Showing
5 changed files
with
39 additions
and
3 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
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
25 changes: 25 additions & 0 deletions
25
client/src/main/java/me/retrodaredevil/solarthing/program/SolarThingEnvironment.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,25 @@ | ||
package me.retrodaredevil.solarthing.program; | ||
|
||
import me.retrodaredevil.solarthing.annotations.Nullable; | ||
import me.retrodaredevil.solarthing.annotations.UtilityClass; | ||
|
||
@UtilityClass | ||
public final class SolarThingEnvironment { | ||
private SolarThingEnvironment() { throw new UnsupportedOperationException(); } | ||
|
||
public static boolean isRunningInDocker() { | ||
return System.getenv("DOCKER") != null; | ||
} | ||
public static @Nullable String getGitCommitHash() { | ||
return emptyToNull(System.getenv("COMMIT_HASH")); | ||
} | ||
public static @Nullable String getVersion() { | ||
return emptyToNull(System.getenv("VERSION")); | ||
} | ||
private static String emptyToNull(String s) { | ||
if (s.isEmpty()) { | ||
return null; | ||
} | ||
return s; | ||
} | ||
} |
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