Skip to content

Commit

Permalink
Parameter extraction path cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nxtautomation committed Jun 15, 2020
1 parent 0758313 commit 72be4e6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
7 changes: 3 additions & 4 deletions shared/web/interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
$stopScript = $scriptsBase . DIRECTORY_SEPARATOR . 'gatewaystop.sh' ;
$updateScript = $scriptsBase . DIRECTORY_SEPARATOR . 'gatewayupdate.sh' ;
$isRunning = $scriptsBase . DIRECTORY_SEPARATOR . 'isRunning.sh' ;
$parameters = $scriptsBase . DIRECTORY_SEPARATOR . 'parameters.sh' ;
$dockerConfigFile = 'gateway/config.yaml';
logMessage("------------------------------------------------------------------------------");
logMessage("Platform Base($platformBase), ModuleBase($moduleBase) scriptBase($scriptsBase)");
Expand Down Expand Up @@ -167,7 +168,7 @@ function restartGateway() {
function configureGateway($port,$satellite,$apiKey,$passphrase){
global $file;
global $output;
global $configureScript, $moduleBase;
global $configureScript, $moduleBase, $parameters;
$jsonString = file_get_contents($file);
$data = json_decode($jsonString, true);

Expand All @@ -191,9 +192,7 @@ function configureGateway($port,$satellite,$apiKey,$passphrase){
$secretkey = "";

header('Content-Type: text/plain');

//$contents = shell_exec('export PATH=$PATH:/share/CACHEDEV1_DATA/.qpkg/container-station/bin ; docker run --rm -v $(pwd)/gateway:/root/.local/share/storj/gateway --entrypoint /bin/cat storjlabs/gateway:latest /root/.local/share/storj/gateway/config.yaml 2>&1 ');

$contents = shell_exec("/bin/bash $parameters 2>&1 ");

$pattern = preg_quote($searchaccesskey, '/');
$pattern = "/^\s*${pattern}\s*:.*\$/m";
Expand Down
8 changes: 0 additions & 8 deletions shared/web/scripts/gatewayupdate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ setupEnv

LOG=$LOGFILE

if [[ $# -lt 1 ]]
then
msg="Not enough parameters to run gateway"
echo $msg
echo $msg >> $LOG
exit 1
fi

echo $(date) $PKGNAME " docker container updater script running " >> $LOG

export PATH=$PATH:${SYS_QPKG_INSTALL_PATH}/container-station/bin
Expand Down
15 changes: 15 additions & 0 deletions shared/web/scripts/parameters.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
# This script extracts the secret key and access key of the gateway
function setupEnv() {
dirpath=$(dirname $0)
export PATH=$PATH:$dirpath
. common.sh
}
setupEnv

LOG=$LOGFILE
echo $(date) "Gateway parameter extraction" >> $LOG
export PATH=$PATH:${SYS_QPKG_INSTALL_PATH}/container-station/bin
moduleBase=${WEB_PATH}/${PKGNAME}
docker run --rm -v ${moduleBase}/gateway:/root/.local/share/storj/gateway --entrypoint /bin/cat storjlabs/gateway:latest /root/.local/share/storj/gateway/config.yaml

0 comments on commit 72be4e6

Please sign in to comment.