All Downloads are FREE. Search and download functionalities are using the official Maven repository.

au.net.causal.maven.plugins.boxdb.db.PostgresFactory Maven / Gradle / Ivy

There is a newer version: 3.3
Show newest version
package au.net.causal.maven.plugins.boxdb.db;

public class PostgresFactory extends DockerDatabaseFactory
{
    public PostgresFactory()
    {
        super("postgres");
    }

    @Override
    protected void initializeDefaults(BoxConfiguration boxConfiguration)
    {
        if (boxConfiguration.getAdminUser() == null)
            boxConfiguration.setAdminUser("postgres");
        if (boxConfiguration.getAdminPassword() == null)
            boxConfiguration.setAdminPassword("postgresbox");
        if (boxConfiguration.getDatabaseName() == null)
            boxConfiguration.setDatabaseName("app");
        if (boxConfiguration.getDatabaseVersion() == null)
            boxConfiguration.setDatabaseVersion("9.5");
        if (boxConfiguration.getDatabasePort() <= 0)
            boxConfiguration.setDatabasePort(5433);
        if (boxConfiguration.getDatabaseUser() == null)
            boxConfiguration.setDatabaseUser(boxConfiguration.getDatabaseName());
        if (boxConfiguration.getDatabasePassword() == null)
            boxConfiguration.setDatabasePassword(boxConfiguration.getDatabaseUser());

        if (!boxConfiguration.getConfiguration().containsKey("collation"))
            boxConfiguration.getConfiguration().put("collation", "C");

        super.initializeDefaults(boxConfiguration);
    }

    @Override
    protected PostgresDatabase createDockerDatabase(BoxConfiguration boxConfiguration, ProjectConfiguration projectConfiguration, BoxContext context)
    throws BoxDatabaseException
    {
        return new PostgresDatabase(boxConfiguration, projectConfiguration, context);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy