-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix #58 - Add Docker Secrets * Remove colon
- Loading branch information
1 parent
02b4383
commit 5743352
Showing
5 changed files
with
210 additions
and
9 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
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
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
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,65 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright 2019 Atos Spain S.A | ||
# | ||
# This file is part of iotagent-lora | ||
# | ||
# iotagent-lora is free software: you can redistribute it and/or | ||
# modify it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the License, | ||
# or (at your option) any later version. | ||
# | ||
# iotagent-lora is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# See the GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public | ||
# License along with iotagent-lora. If not, see http://www.gnu.org/licenses/. | ||
# | ||
|
||
# usage: file_env VAR [DEFAULT] | ||
# ie: file_env 'XYZ_DB_PASSWORD' 'example' | ||
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of | ||
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) | ||
file_env() { | ||
local var="$1" | ||
local fileVar="${var}_FILE" | ||
local def="${2:-}" | ||
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then | ||
echo >&2 "error: both $var and $fileVar are set (but are exclusive)" | ||
exit 1 | ||
fi | ||
local val="$def" | ||
if [ "${!var:-}" ]; then | ||
val="${!var}" | ||
elif [ "${!fileVar:-}" ]; then | ||
val="$(< "${!fileVar}")" | ||
fi | ||
export "$var"="$val" | ||
unset "$fileVar" | ||
} | ||
|
||
file_env 'IOTA_AUTH_USER' | ||
file_env 'IOTA_AUTH_PASSWORD' | ||
file_env 'IOTA_AUTH_CLIENT_ID' | ||
file_env 'IOTA_AUTH_CLIENT_SECRET' | ||
|
||
|
||
if [[ -z "$IOTA_AUTH_ENABLED" ]]; then | ||
echo "***********************************************" | ||
echo "WARNING: It is recommended to enable authentication for secure connection" | ||
echo "***********************************************" | ||
else | ||
if [[ -z "$IOTA_AUTH_USER" ]] || [ -z "$IOTA_AUTH_PASSWORD" ]]; then | ||
echo "***********************************************" | ||
echo "WARNING: Default IoT Agent Auth credentials have not been overridden" | ||
echo "***********************************************" | ||
else | ||
echo "***********************************************" | ||
echo "INFO: IoT Agent Auth credentials have been overridden" | ||
echo "***********************************************" | ||
fi | ||
fi | ||
|
||
pm2-runtime /opt/iotagent-lora/bin/iotagent-lora |
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,21 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright 2019 Atos Spain S.A | ||
# | ||
# This file is part of iotagent-lora | ||
# | ||
# iotagent-lora is free software: you can redistribute it and/or | ||
# modify it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the License, | ||
# or (at your option) any later version. | ||
# | ||
# iotagent-lora is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# See the GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public | ||
# License along with iotagent-lora. If not, see http://www.gnu.org/licenses/. | ||
# | ||
|
||
docker build --build-arg SOURCE_BRANCH=$SOURCE_BRANCH -t $IMAGE_NAME . |