Skip to content

Commit

Permalink
[Fix] handel file
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangcheng authored and zhangcheng committed Aug 4, 2019
1 parent 1d79afa commit 3b13d68
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions init.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
import config_generator
import uuid

data = {}
with open("/usr/local/V2ray.Fun/v2ray.config") as f:
data = json.load(f)
try:
data = json.load(f)
except ValueError:
data = {}

data['uuid'] = str(uuid.uuid4())
data['ip'] = config_generator.getip()
config_generator.open_port(data['port'])

with open("/usr/local/V2ray.Fun/v2ray.config", "w") as f:
f.write(json.dump(data))
json.dump(data, f)

config_generator.gen_server()
config_generator.gen_client()

0 comments on commit 3b13d68

Please sign in to comment.