Skip to content

Commit

Permalink
Fix PlayEbean configuration loading for sub projects (#209) (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioBotDuComptoirDesPharmacies authored May 25, 2021
1 parent f02e274 commit 36c6f65
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions play-ebean/src/main/java/play/db/ebean/ModelsConfigLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

package play.db.ebean;

import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import play.Environment;
import play.Mode;
import play.api.Environment;
import play.api.Configuration;

import java.io.File;
import java.util.List;
Expand All @@ -24,8 +23,8 @@ public class ModelsConfigLoader implements Function<ClassLoader, Map<String, Lis
@Override
public Map<String, List<String>> apply(ClassLoader classLoader) {
// Using TEST mode is the only way to load configuration without failing if application.conf doesn't exist
Environment env = new Environment(new File("."), classLoader, Mode.TEST);
Config config = ConfigFactory.load(env.classLoader());
return EbeanParsedConfig.parseFromConfig(config).getDatasourceModels();
Environment env = new Environment(new File("."), classLoader, Mode.TEST.asScala());
Configuration config = Configuration.load(env);
return EbeanParsedConfig.parseFromConfig(config.underlying()).getDatasourceModels();
}
}

0 comments on commit 36c6f65

Please sign in to comment.