Skip to content

Commit

Permalink
Update step 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman3455 committed Dec 30, 2024
1 parent b47aac8 commit bedef50
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 0 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ dependencies {
implementation("com.h2database:h2:2.2.224")
implementation("com.zaxxer:HikariCP:6.2.1")

implementation("io.github.cdimascio:java-dotenv:5.2.2")

testImplementation(platform("org.junit:junit-bom:5.10.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.assertj:assertj-core:3.26.3")
Expand Down
7 changes: 2 additions & 5 deletions app/src/main/java/hexlet/code/App.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package hexlet.code;

import io.github.cdimascio.dotenv.Dotenv;

import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import hexlet.code.repository.BaseRepository;
Expand All @@ -18,19 +16,18 @@

@Slf4j
public final class App {
private static final Dotenv dotenv = Dotenv.load();

public static void main(String[] args) throws SQLException, IOException {
Javalin app = getApp();
app.start(getPort());
}

private static int getPort() {
return Integer.parseInt(dotenv.get("PORT", "7070"));
return Integer.parseInt(System.getenv().getOrDefault("PORT", "7070"));
}

private static String getDatabaseUrl() {
return dotenv.get("JDBC_DATABASE_URL",
return System.getenv().getOrDefault("JDBC_DATABASE_URL",
"jdbc:h2:mem:project;DB_CLOSE_DELAY=-1;");
}

Expand Down

0 comments on commit bedef50

Please sign in to comment.