mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-31 18:38:10 +00:00 
			
		
		
		
	cloud_discovery: make use of the new TIP cloud discovery server
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
		| @@ -157,15 +157,16 @@ function discover_dhcp() { | ||||
| function redirector_lookup() { | ||||
| 	const path = '/tmp/ucentral.redirector'; | ||||
| 	ulog(LOG_INFO, 'Contact redirector service\n'); | ||||
| 	let serial = uci.get('ucentral', 'config', 'serial'); | ||||
| 	let serial = uci.get('system', '@system[-1]', 'mac'); | ||||
|  | ||||
| 	fs.unlink(path); | ||||
| 	system(`wget http://ucentral.io/${serial} -O /tmp/ucentral.redirector`); | ||||
| 	system(`curl -k --cert /etc/ucentral/cert.pem --key /etc/ucentral/key.pem --cacert /etc/ucentral/cas.pem https://openlan.keys.tip.build/v1/devices/${serial} --output /tmp/ucentral.redirector`); | ||||
| 	if (!fs.stat(path)) | ||||
| 		return; | ||||
| 	let redir = readjsonfile(path); | ||||
| 	if (redir?.server && redir?.port) { | ||||
|                 if (gateway_write({ server: redir.server, port: redir.port, valid: false })) { | ||||
| 	if (redir?.controller_endpoint) { | ||||
| 		let controller_endpoint = split(redir.controller_endpoint, ':'); | ||||
| 		if (gateway_write({ server: controller_endpoint[0], port: controller_endpoint[1] || 15002, valid: false })) { | ||||
| 			ulog(LOG_INFO, `Discovered cloud via lookup service ${redir.server}:${redir.port}\n`); | ||||
|                         client_start(); | ||||
|                 	set_state(VALIDATING); | ||||
|   | ||||
| @@ -2,6 +2,7 @@ | ||||
|  | ||||
| hname=$(cat /etc/board.json  | jsonfilter -e '@.system.label_macaddr') | ||||
| [ -z "$hname" ] && hname=$(cat /sys/class/net/eth0/address) | ||||
| uci set system.@system[-1].mac=$hname | ||||
| hname=$(echo $hname | tr -d : | awk '{print tolower($0)}') | ||||
| uci set system.@system[-1].hostname=$hname | ||||
| uci set ucentral.config.serial=$hname | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 John Crispin
					John Crispin