Changeset 37307aa for backend


Ignore:
Timestamp:
04/21/26 18:07:57 (3 months ago)
Author:
Andrej <asumanovski@…>
Branches:
master
Children:
89156c1
Parents:
c4c43f3
Message:

env file issue fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • backend/src/main/java/com/trekr/backend/BackendApplication.java

    rc4c43f3 r37307aa  
    44import org.springframework.boot.SpringApplication;
    55import org.springframework.boot.autoconfigure.SpringBootApplication;
     6
     7import java.nio.file.Files;
     8import java.nio.file.Path;
     9import java.nio.file.Paths;
    610
    711@SpringBootApplication
     
    6064        for (String[] candidate : candidates) {
    6165            try {
     66                Path envPath = Paths.get(candidate[0], candidate[1]).normalize();
     67                if (!Files.isRegularFile(envPath)) {
     68                    continue;
     69                }
     70
    6271                Dotenv loaded = Dotenv.configure()
    63                         .directory(candidate[0])
    64                         .filename(candidate[1])
     72                        .directory(envPath.getParent().toString())
     73                        .filename(envPath.getFileName().toString())
    6574                        .ignoreIfMissing()
    6675                        .load();
    67                 if (loaded != null && !loaded.entries().isEmpty()) {
     76                if (loaded != null) {
    6877                    dotenv = loaded;
    6978                    break;
Note: See TracChangeset for help on using the changeset viewer.