package hu.rbr.sfinapp;

import hu.rbr.sfinapp.core.config.Config;
import org.flywaydb.core.Flyway;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.inject.Inject;

public class FlywayRunner {

    private final Logger log = LoggerFactory.getLogger(getClass());

    private final Config config;

    @Inject
    public FlywayRunner(Config config) {
        this.config = config;
    }

    public void run() {
        log.info("Starting flyway.");

        // Create the Flyway instance
        Flyway flyway = new Flyway();

        // Point it to the database
        flyway.setDataSource(config.get("db.url"), config.get("db.username"), config.get("db.password"));

        // Start the migration
        flyway.migrate();
    }
}

@@ -22,50 +22,8 @@
 p;%0A%0A
-import hu.rbr.sfinapp.core.config.Config;%0A
 impo
@@ -136,16 +136,45 @@
 .Inject;
+%0Aimport javax.sql.DataSource;
 %0A%0Apublic
@@ -283,29 +283,37 @@
 e final 
-Config config
+DataSource dataSource
 ;%0A%0A    @
@@ -347,53 +347,69 @@
 ner(
-Config config) %7B%0A        this.config = config
+DataSource dataSource) %7B%0A        this.dataSource = dataSource
 ;%0A  
@@ -622,82 +622,18 @@
 rce(
-config.get(%22db.url%22), config.get(%22db.username%22), config.get(%22db.password%22)
+dataSource
 );%0A%0A

Fix Flyway datasource init