Moved GoogleDrive settings to EEAppConfig. Bean now passing config as an object

This commit is contained in:
Connor Yoh 2025-03-27 14:09:45 +00:00
parent 542b2dda52
commit 8438413935
3 changed files with 15 additions and 24 deletions

View File

@ -11,6 +11,7 @@ import stirling.software.SPDF.EE.KeygenLicenseVerifier.License;
import stirling.software.SPDF.model.ApplicationProperties;
import stirling.software.SPDF.model.ApplicationProperties.EnterpriseEdition;
import stirling.software.SPDF.model.ApplicationProperties.Premium;
import stirling.software.SPDF.model.ApplicationProperties.Premium.ProFeatures.GoogleDrive;
@Configuration
@Order(Ordered.HIGHEST_PRECEDENCE)
@ -43,6 +44,17 @@ public class EEAppConfig {
return applicationProperties.getPremium().getProFeatures().isSsoAutoLogin();
}
@Bean(name = "GoogleDriveEnabled")
public boolean googleDriveEnabled() {
return runningProOrHigher()
&& applicationProperties.getPremium().getProFeatures().getGoogleDrive().isEnabled();
}
@Bean(name = "GoogleDriveConfig")
public GoogleDrive googleDriveConfig() {
return applicationProperties.getPremium().getProFeatures().getGoogleDrive();
}
// TODO: Remove post migration
public void migrateEnterpriseSettingsToPremium(ApplicationProperties applicationProperties) {
EnterpriseEdition enterpriseEdition = applicationProperties.getEnterpriseEdition();

View File

@ -195,25 +195,4 @@ public class AppConfig {
public String uuid() {
return applicationProperties.getAutomaticallyGenerated().getUUID();
}
@Bean(name = "GoogleDriveEnabled")
public boolean googleDriveEnabled() {
return applicationProperties.getPremium().isEnabled()
&& applicationProperties.getPremium().getProFeatures().getGoogleDrive().isEnabled();
}
@Bean(name = "GoogleDriveClientId")
public String googleDriveClientId() {
return applicationProperties.getPremium().getProFeatures().getGoogleDrive().getClientId();
}
@Bean(name = "GoogleDriveApiKey")
public String googleDriveApiKey() {
return applicationProperties.getPremium().getProFeatures().getGoogleDrive().getApiKey();
}
@Bean(name = "GoogleDriveAppId")
public String googleDriveAppId() {
return applicationProperties.getPremium().getProFeatures().getGoogleDrive().getAppId();
}
}

View File

@ -268,9 +268,9 @@
<script async defer src="https://accounts.google.com/gsi/client" onload="gisLoaded()"></script>
<script th:inline="javascript">
const CLIENT_ID = /*[[${@GoogleDriveClientId}]]*/ null;
const API_KEY = /*[[${@GoogleDriveApiKey}]]*/ null;
const APP_ID = /*[[${@GoogleDriveAppId}]]*/ null;
const CLIENT_ID = /*[[${@GoogleDriveConfig.getClientId()}]]*/ null;
const API_KEY = /*[[${@GoogleDriveConfig.getApiKey()}]]*/ null;
const APP_ID = /*[[${@GoogleDriveConfig.getAppId()}]]*/ null;
</script>
</div>