com.infusers.core.secrets.dto.DBSecrets Maven / Gradle / Ivy
package com.infusers.core.secrets.dto;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Component
@ConfigurationProperties(prefix = "spring.datasource")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DBSecrets implements ISecrets {
private String username;
private String password;
private String url;
private String host;
private String engine;
private String port;
private String dbname;
public void setUsername(String username) {
this.username = username;
}
public void setPassword(String password) {
this.password = password;
}
public void setUrl(String url) {
this.url = url;
}
public void setHost(String host) {
this.host = host;
}
public void setEngine(String engine) {
this.engine = engine;
}
public void setPort(String port) {
this.port = port;
}
public void setDbname(String dbname) {
this.dbname = dbname;
}
public void setDbInstanceIdentifier(String dbInstanceIdentifier) {
this.dbInstanceIdentifier = dbInstanceIdentifier;
}
private String dbInstanceIdentifier;
public String getDbname() {
return dbname;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
public String getUrl() {
return url;
}
public String getHost() {
return host;
}
public String getEngine() {
return engine;
}
public String getPort() {
return port;
}
public String getDbInstanceIdentifier() {
return dbInstanceIdentifier;
}
public boolean isValidCloud() {
return isValidField(username) &&
isValidField(password) &&
isValidField(host) &&
isValidField(engine) &&
isValidField(port) &&
isValidField(dbname);
}
public boolean isValidNonCloud() {
return isValidField(username) &&
isValidField(password) &&
isValidField(url);
}
private boolean isValidField(String field) {
return field != null && !field.isEmpty();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy