-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch.py
More file actions
26 lines (20 loc) · 786 Bytes
/
launch.py
File metadata and controls
26 lines (20 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import socket
import os
import sys
def getCurrentIpAddress():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("100.255.255.255", 80))
currentIpAddress = s.getsockname()[0]
s.close()
return currentIpAddress
currentIpAddress = getCurrentIpAddress()
port = 9999
netEnvFilePath = os.path.join("Inv_Backend_NET" , ".env")
with open(netEnvFilePath, "w") as netEnv:
netEnv.writelines(f"APP_URL=http://{currentIpAddress}:{port}")
webEnvFilePath = os.path.join("Inv_Backend_NET" , "web" , "assets" , "env_file")
with open(webEnvFilePath , "w") as webEnv:
webEnv.write(f"API_URL=http://{currentIpAddress}:{port}/api\n")
webEnv.write(f"WEBSOCKET_URL=ws://{currentIpAddress}:{port}/ws\n")
os.chdir("Inv_Backend_NET")
os.system("dotnet run")