File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 36
36
),
37
37
)
38
38
39
- PORT = 15555
39
+ host = os .environ .get ("S3DAEMON_HOST" , "localhost" )
40
+ port = int (os .environ .get ("S3DAEMON_PORT" , 15555 ))
40
41
endpoint_url = os .environ ["S3_ENDPOINT_URL" ]
41
42
access_key = os .environ ["AWS_ACCESS_KEY_ID" ]
42
43
secret_key = os .environ ["AWS_SECRET_ACCESS_KEY" ]
@@ -89,7 +90,7 @@ async def main():
89
90
async def client_cb (reader , writer ):
90
91
await handle_client (client , reader , writer )
91
92
92
- server = await asyncio .start_server (client_cb , "localhost" , PORT )
93
+ server = await asyncio .start_server (client_cb , host , port )
93
94
log .info ("Starting server" )
94
95
async with server :
95
96
await server .serve_forever ()
Original file line number Diff line number Diff line change 19
19
# You should have received a copy of the GNU General Public License
20
20
# along with this program. If not, see <https://www.gnu.org/licenses/>.
21
21
22
+ import os
22
23
import socket
23
24
import sys
24
25
25
- PORT = 15555
26
+ host = os .environ .get ("S3DAEMON_HOST" , "localhost" )
27
+ port = int (os .environ .get ("S3DAEMON_PORT" , 15555 ))
26
28
27
29
28
30
def send (filename , dest ):
@@ -37,7 +39,7 @@ def send(filename, dest):
37
39
The key may contain slashes.
38
40
"""
39
41
with socket .socket (socket .AF_INET , socket .SOCK_STREAM ) as sock :
40
- sock .connect (("localhost" , PORT ))
42
+ sock .connect ((host , port ))
41
43
sock .sendall (bytes (f"{ filename } { dest } \n " , "UTF-8" ))
42
44
received = str (sock .recv (4096 ), "utf-8" )
43
45
sock .close ()
You can’t perform that action at this time.
0 commit comments