1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
config.php
См. документацию.
1<?php
2
3namespace Bitrix\Pull\SharedServer;
4
5use Bitrix\Main\Config\Option;
6use Bitrix\Main\License\UrlProvider;
7
8class Config
9{
10 const HOSTNAME_URL = "/hostname";
11 const SERVER_LIST_URL = "/servers";
12 const REGISTER_URL = "/register-client/";
13 const PUB_URL = "/pub/";
14 const SUB_URL = "/subws/";
15 const REST_URL = "/rest/";
16 const RPC_URL = "/api/";
17
18 const SERVER_ADDRESS = 'shared_server_address';
19 const SHARED_SERVER_KEY = 'shared_server_key';
20 const IS_REGISTERED_ON_SHARED_SERVER = 'registered_on_shared_server';
22
23 public static function getServerVersion()
24 {
25 return static::CLOUD_SERVER_VERSION;
26 }
27
28 public static function getDefaultCloudServer(): string
29 {
30 return defined('PULL_CLOUD_SERVER') ? PULL_CLOUD_SERVER : static::getDefaultServer();
31 }
32
33 public static function getDefaultServer()
34 {
35 $domain = (new UrlProvider())->getTechDomain();
36
37 return 'https://rtc-cloud.' . $domain;
38 }
39
40 public static function getServerAddress()
41 {
42 return Option::get("pull", static::SERVER_ADDRESS);
43 }
44
45 public static function setServerAddress($serverAddress)
46 {
47 Option::set("pull", static::SERVER_ADDRESS, $serverAddress);
48 }
49
50 public static function getRegisterUrl()
51 {
52 return "https://" . static::getServerAddress() . (defined("PULL_SHARED_REGISTER_URL") ? PULL_SHARED_REGISTER_URL : static::REGISTER_URL);
53 }
54
60 public static function getPublishUrl()
61 {
62 return "https://" . static::getServerAddress() . static::PUB_URL;
63 }
64
70 public static function getJsonRpcUrl()
71 {
72 return "https://" . static::getServerAddress() . static::RPC_URL;
73 }
74
80 public static function getLongPollingUrl()
81 {
82 return "https://" . static::getServerAddress() . static::SUB_URL;
83 }
84
90 public static function getWebSocketUrl()
91 {
92 $result = "wss://" . static::getServerAddress() . static::SUB_URL;
93 return $result;
94 }
95
99 public static function getWebPublishUrl()
100 {
101 return "https://" . static::getServerAddress() . static::REST_URL;
102 }
103
104 public static function setSignatureKey($signatureKey)
105 {
106 Option::set("pull", static::SHARED_SERVER_KEY, $signatureKey);
107 }
108
109 public static function getSignatureKey()
110 {
111 return Option::get("pull", static::SHARED_SERVER_KEY);
112 }
113
114 public static function setRegistered($isRegistered)
115 {
116 Option::set("pull", static::IS_REGISTERED_ON_SHARED_SERVER, ($isRegistered ? "Y" : "N"));
117 }
118
119 public static function isRegistered()
120 {
121 return (Option::get("pull", static::IS_REGISTERED_ON_SHARED_SERVER) === "Y");
122 }
123}
const SHARED_SERVER_KEY
Определения config.php:19
static getWebPublishUrl()
Определения config.php:99
static getServerAddress()
Определения config.php:40
static setSignatureKey($signatureKey)
Определения config.php:104
const HOSTNAME_URL
Определения config.php:10
static setServerAddress($serverAddress)
Определения config.php:45
static isRegistered()
Определения config.php:119
const PUB_URL
Определения config.php:13
static getDefaultCloudServer()
Определения config.php:28
const REGISTER_URL
Определения config.php:12
const REST_URL
Определения config.php:15
const SUB_URL
Определения config.php:14
static setRegistered($isRegistered)
Определения config.php:114
const CLOUD_SERVER_VERSION
Определения config.php:21
const RPC_URL
Определения config.php:16
const SERVER_ADDRESS
Определения config.php:18
static getDefaultServer()
Определения config.php:33
static getRegisterUrl()
Определения config.php:50
const IS_REGISTERED_ON_SHARED_SERVER
Определения config.php:20
const SERVER_LIST_URL
Определения config.php:11
static getLongPollingUrl()
Определения config.php:80
static getPublishUrl()
Определения config.php:60
static getJsonRpcUrl()
Определения config.php:70
static getSignatureKey()
Определения config.php:109
static getWebSocketUrl()
Определения config.php:90
static getServerVersion()
Определения config.php:23
$result
Определения get_property_values.php:14