-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #172 from tomochain/feature/docker-bootnode
Refactor bootnode docker
- Loading branch information
Showing
3 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/sh -x | ||
|
||
# file to env | ||
for env in PRIVATE_KEY; do | ||
file=$(eval echo "\$${env}_FILE") | ||
if [[ -f $file ]] && [[ ! -z $file ]]; then | ||
echo "Replacing $env by $file" | ||
export $env=$(cat $file) | ||
fi | ||
done | ||
|
||
# private key | ||
if [[ ! -z "$PRIVATE_KEY" ]]; then | ||
echo "$PRIVATE_KEY" > bootnode.key | ||
elif [[ ! -f ./bootnode.key ]]; then | ||
bootnode -genkey bootnode.key | ||
fi | ||
|
||
# dump address | ||
address="enode://$(bootnode -nodekey bootnode.key -writeaddress)@[$(hostname -i)]:30301" | ||
|
||
echo "$address" > ./bootnodes/bootnodes | ||
|
||
exec bootnode "$@" |