mirror of
				https://github.com/samply/bridgehead.git
				synced 2025-11-04 11:50:17 +01:00 
			
		
		
		
	refactor: beam file send is only an executable command
This commit is contained in:
		@@ -184,9 +184,8 @@ case "$ACTION" in
 | 
				
			|||||||
		loadVars
 | 
							loadVars
 | 
				
			||||||
		log "WARNING" "Your are about to send a file to another bridgehead in your network!"
 | 
							log "WARNING" "Your are about to send a file to another bridgehead in your network!"
 | 
				
			||||||
		read -p "Please name the bridgehead you want to send the file to (proxy-id): " RECEIVER_PROXY_ID
 | 
							read -p "Please name the bridgehead you want to send the file to (proxy-id): " RECEIVER_PROXY_ID
 | 
				
			||||||
		read -p "Please type the path to the file you want to upload: " FILE_TO_SEND_PATH
 | 
					 | 
				
			||||||
        read -p "Continue? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1
 | 
					        read -p "Continue? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1
 | 
				
			||||||
		curl -X POST -F "data=@$FILE_TO_SEND_PATH" -u ":${BEAM_FILE_API_KEY}" http://localhost:8085/send/$RECEIVER_PROXY_ID
 | 
							exec $COMPOSE -f ./modules/beam-file-compose.yml --profile beam-file-sender run beam-file-sender send --to beamfile.$1 /data/outfile
 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
	*)
 | 
						*)
 | 
				
			||||||
		printUsage
 | 
							printUsage
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,8 @@ services:
 | 
				
			|||||||
    # Only uncomment if your are sure what to do
 | 
					    # Only uncomment if your are sure what to do
 | 
				
			||||||
    # ports:
 | 
					    # ports:
 | 
				
			||||||
    #   - 8085:8085
 | 
					    #   - 8085:8085
 | 
				
			||||||
    command: ["send", "--to", "beamfile"]
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - /var/cache/bridgehead/beam-file-out/:/data
 | 
				
			||||||
    profiles: ["beam-file-sender"]
 | 
					    profiles: ["beam-file-sender"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  beam-file-receiver:
 | 
					  beam-file-receiver:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,14 +1,7 @@
 | 
				
			|||||||
#!/bin/bash -e
 | 
					#!/bin/bash -e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function beamFileSetup() {
 | 
					function beamFileSetup() {
 | 
				
			||||||
    if [ -n "$ENABLE_BEAM_FILE_SENDER" ]; then
 | 
					    if [ -n "$ENABLE_BEAM_FILE_RECEIVER" ]; then
 | 
				
			||||||
       echo "Starting beam file in sender mode"
 | 
					 | 
				
			||||||
       OVERRIDE+=" -f ./modules/beam-file-compose.yml --profile beam-file-sender"
 | 
					 | 
				
			||||||
       BEAM_FILE_SECRET="$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 20)"
 | 
					 | 
				
			||||||
       # NOTE: We could make this persistent across restarts
 | 
					 | 
				
			||||||
       BEAM_FILE_API_KEY="$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 20)"
 | 
					 | 
				
			||||||
       log INFO "Beam File in Sender Mode available uses ApiKey ${BEAM_FILE_API_KEY}"
 | 
					 | 
				
			||||||
    elif [ -n "$ENABLE_BEAM_FILE_RECEIVER" ]; then
 | 
					 | 
				
			||||||
       echo "Starting beam file in receiver mode"
 | 
					       echo "Starting beam file in receiver mode"
 | 
				
			||||||
       OVERRIDE+=" -f ./modules/beam-file-compose.yml --profile beam-file-receiver"
 | 
					       OVERRIDE+=" -f ./modules/beam-file-compose.yml --profile beam-file-receiver"
 | 
				
			||||||
       BEAM_FILE_SECRET="$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 20)"
 | 
					       BEAM_FILE_SECRET="$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 20)"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user