Skip to content

Commit

Permalink
Pass variables from env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
reagan-meant committed Dec 3, 2023
1 parent 6ae7e92 commit e693659
Showing 1 changed file with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,50 @@
import org.openmrs.api.AdministrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
* Contains module's config.
*/
@Component
public class ClientRegistryConfig {

public final static String MODULE_PRIVILEGE = "Client Registry Privilege";

@Autowired
@Qualifier("adminService")
AdministrationService administrationService;


@Value("${clientregistry.serverUrl}")
private String serverUrl;

@Value("${clientregistry.username}")
private String username;

@Value("${clientregistry.password}")
private String password;

@Value("${clientregistry.identifierRoot}")
private String identifierRoot;

public boolean clientRegistryConnectionEnabled() {
return StringUtils.isNotBlank(getClientRegistryServerUrl());
}

public String getClientRegistryServerUrl() {
return administrationService.getGlobalProperty(ClientRegistryConstants.GP_CLIENT_REGISTRY_SERVER_URL);
return serverUrl;
}

public String getClientRegistryUserName() {
return administrationService.getGlobalProperty(ClientRegistryConstants.GP_CLIENT_REGISTRY_USER_NAME);
return username;
}

public String getClientRegistryPassword() {
return administrationService.getGlobalProperty(ClientRegistryConstants.GP_CLIENT_REGISTRY_PASSWORD);
return password;
}

public String getClientRegistryIdentifierRoot() {
return administrationService.getGlobalProperty(ClientRegistryConstants.GP_CLIENT_REGISTRY_IDENTIFIER_ROOT);
return identifierRoot;
}
}

0 comments on commit e693659

Please sign in to comment.