Skip to content

Commit d15e6d6

Browse files
authored
Merge pull request #7525 from ant-media/local-license-server-support
Local license server support
2 parents 5d0491a + d86b2c4 commit d15e6d6

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

src/main/java/io/antmedia/licence/ILicenceService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public interface ILicenceService {
99
public static final String LICENCE_TYPE_STANDARD = "standard";
1010
public static final String LICENCE_TYPE_OFFLINE = "offline";
1111
public static final String LICENCE_TYPE_MARKETPLACE = "marketplace";
12+
public static final String LICENCE_TYPE_LOCAL_SERVER = "local_server";
1213

1314

1415
public enum BeanName {

src/main/java/io/antmedia/settings/ServerSettings.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ public class ServerSettings implements ApplicationContextAware, Serializable {
101101

102102
private static final String RTMPS_ENABLED = "rtmps.enabled";
103103

104+
private static final String LOCAL_LICENCE_SERVER_IP = "server.localLicenceServerIp";
105+
104106
/**
105107
* The IP filter that is allowed to access the web panel of Ant Media Server
106108
*/
@@ -277,6 +279,13 @@ public class ServerSettings implements ApplicationContextAware, Serializable {
277279
private String serverStatusWebHookURL;
278280

279281

282+
/**
283+
* Customer License Key
284+
*/
285+
@Value( "${"+LOCAL_LICENCE_SERVER_IP+":#{null}}" )
286+
private String localLicenceServerIps;
287+
288+
280289
public String getJwksURL() {
281290
return jwksURL;
282291
}
@@ -697,4 +706,11 @@ public void setRtmpsEnabled(boolean rtmpsEnabled) {
697706
ServerSettings.rtmpsEnabled = rtmpsEnabled;
698707
}
699708

709+
public String getLocalLicenceServerIps() {
710+
return localLicenceServerIps;
711+
}
712+
713+
public void setLocalLicenceServerIps(String localLicenceServerIps) {
714+
this.localLicenceServerIps = localLicenceServerIps;
715+
}
700716
}

src/test/java/io/antmedia/test/license/CommunityLicenseServiceTest.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package io.antmedia.test.license;
22

3-
import static org.junit.Assert.assertNotNull;
4-
import static org.junit.Assert.assertNull;
5-
63
import org.junit.After;
74
import org.junit.Before;
85
import org.junit.Test;
@@ -14,6 +11,8 @@
1411
import io.antmedia.licence.ILicenceService;
1512
import io.antmedia.settings.ServerSettings;
1613

14+
import static org.junit.Assert.*;
15+
1716
public class CommunityLicenseServiceTest {
1817

1918
protected static Logger logger = LoggerFactory.getLogger(CommunityLicenseServiceTest.class);
@@ -49,5 +48,15 @@ public void testCheckLicence() {
4948

5049
assertNotNull(ILicenceService.BeanName.LICENCE_SERVICE.toString());
5150
}
52-
51+
52+
/**
53+
* This test exists for sonar not to complain in CommunityEdition.
54+
* All actual testing is done in enterprise tests, but sonar running on community edition doesn't know that and complains
55+
*/
56+
@Test
57+
public void testLocalLicenceServerSettings() {
58+
ServerSettings serverSettings = new ServerSettings();
59+
serverSettings.setLocalLicenceServerIps("192.168.1.100:3535");
60+
assertEquals(serverSettings.getLocalLicenceServerIps(), "192.168.1.100:3535");
61+
}
5362
}

0 commit comments

Comments
 (0)