parent
1d6849058b
commit
d1e590b787
@ -0,0 +1,25 @@
|
||||
#shellcheck shell=sh
|
||||
set -eu
|
||||
|
||||
Describe 'Dependency'
|
||||
Describe 'ipfs:'
|
||||
It 'is available'
|
||||
When run ipfs --help
|
||||
The output should include "ipfs"
|
||||
The status should be success
|
||||
The stderr should equal ""
|
||||
End
|
||||
End
|
||||
End
|
||||
|
||||
Describe 'Astroport'
|
||||
Describe 'template_register'
|
||||
Include ./tools/template.sh
|
||||
It 'creates host html register page'
|
||||
When call template_register
|
||||
The output should include $(hostname)
|
||||
The status should be success
|
||||
The stderr should equal ""
|
||||
End
|
||||
End
|
||||
End
|
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
MY_PATH="$(pwd -P)" # absolute
|
||||
ME="${0##*/}"
|
||||
|
||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||
IPFSNODEID=$(jq -r .Identity.PeerID ~/.ipfs/config)
|
||||
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
|
||||
isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
|
||||
|
||||
myDOMAINName=$(hostname -d 2>/dev/null) && [ -z "$myDOMAINName" ] && myDOMAINName=$(domainname 2>/dev/null) && [[ "$myDOMAINName" == "(none)" ]] && myDOMAINName="localhost"
|
||||
myHOSTName=$(hostname |sed 's/\.'${myDOMAINName}'$//')
|
||||
[ -n "$myDOMAINName" ] && myHOSTName="${myHOSTName}.${myDOMAINName}" || myDOMAINName=${myHOSTName#*.}
|
||||
[ -z "$myDOMAINName" ] && myDOMAINName=localhost
|
||||
myHOST="astroport.${myDOMAINName}"
|
||||
myIPFS="http://ipfs.${myDOMAINName}:8080"
|
||||
myASTROPORT="http://astroport.${myDOMAINName}:1234"
|
||||
|
||||
[[ ! $isLAN || $USER == "zen" ]] && myIPFS="https://ipfs.${myDOMAINName}" && myASTROPORT="https://astroport.${myDOMAINName}" ## WAN STATION
|
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
template_register() {
|
||||
echo $(hostname)
|
||||
}
|
Loading…
Reference in new issue