diff --git a/tenant-service/src/main/java/com/xuqm/tenant/controller/AppController.java b/tenant-service/src/main/java/com/xuqm/tenant/controller/AppController.java index 7d02378..2ee207d 100644 --- a/tenant-service/src/main/java/com/xuqm/tenant/controller/AppController.java +++ b/tenant-service/src/main/java/com/xuqm/tenant/controller/AppController.java @@ -12,6 +12,7 @@ import com.xuqm.tenant.service.AppUserClient; import com.xuqm.tenant.service.EmailService; import com.xuqm.tenant.service.FeatureServiceManager; import com.xuqm.tenant.service.LicenseFileCrypto; +import com.xuqm.tenant.config.PrivateDeploymentProperties; import com.xuqm.tenant.service.OperationLogService; import jakarta.validation.Valid; import org.springframework.beans.factory.annotation.Value; @@ -43,6 +44,7 @@ public class AppController { private final TenantRepository tenantRepository; private final FeatureServiceManager featureServiceManager; private final AppUserClient appUserClient; + private final PrivateDeploymentProperties deployProps; @Value("${license.public-base-url:https://auth.dev.xuqinmin.com/}") private String licensePublicBaseUrl; @@ -51,13 +53,15 @@ public class AppController { OperationLogService operationLogService, TenantRepository tenantRepository, FeatureServiceManager featureServiceManager, - AppUserClient appUserClient) { + AppUserClient appUserClient, + PrivateDeploymentProperties deployProps) { this.appService = appService; this.emailService = emailService; this.operationLogService = operationLogService; this.tenantRepository = tenantRepository; this.featureServiceManager = featureServiceManager; this.appUserClient = appUserClient; + this.deployProps = deployProps; } @GetMapping @@ -178,6 +182,11 @@ public class AppController { payload.put("appName", app.getName()); payload.put("packageName", app.getPackageName()); payload.put("baseUrl", normalizeBaseUrl(licensePublicBaseUrl)); + // serverUrl is set only for private deployments; the SDK uses it to configure all service + // endpoints automatically via XuqmSDK.autoInitialize(). Public deployments use default endpoints. + if (deployProps.isPrivate()) { + payload.put("serverUrl", normalizeBaseUrl(licensePublicBaseUrl)); + } payload.put("issuedAt", java.time.Instant.now().toString()); String encrypted = LicenseFileCrypto.encrypt(new com.fasterxml.jackson.databind.ObjectMapper().valueToTree(payload).toString()); String filename = sanitizeFileName(app.getName()) + ".xuqmlicense";