package org.dromara.common.mybatis.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

@Component
public class DataSourceConfig {

    private final Environment environment;

    @Autowired
    public DataSourceConfig(Environment environment) {
        this.environment = environment;
    }

    public String getDatabaseUrl() {
        return environment.getProperty("spring.datasource.dynamic.datasource.master.url");
    }

    public String getDatabaseUsername() {
        return environment.getProperty("spring.datasource.dynamic.datasource.master.username");
    }

    public String getDatabasePassword() {
        return environment.getProperty("spring.datasource.dynamic.datasource.master.password");
    }
}
