add python

This commit is contained in:
Luckysideburn
2022-10-21 06:07:53 +00:00
parent df850ef4f4
commit 89781287a5
3 changed files with 18 additions and 1 deletions
+13
View File
@@ -9,11 +9,24 @@ else
k8s_url = os.getenv("ENDPOINT")
end
ngx.header['Access-Control-Allow-Origin'] = '*'
ngx.header['Access-Control-Allow-Methods'] = 'GET, POST, OPTIONS'
ngx.header['Access-Control-Allow-Headers'] = 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'
ngx.header['Access-Control-Expose-Headers'] = 'Content-Length,Content-Range';
ngx.req.read_body()
local token = os.getenv("TOKEN")
local arg = ngx.req.get_uri_args()
local body_data = ngx.req.get_body_data()
ngx.log(ngx.ERR, "[programming_mode]" .. body_data)
file = io.open("/tmp/experiments.yaml", "w")
io.output(file)
io.write(body_data)
io.close(file)
local handle = io.popen("python3 /opt/programming_mode/start.py")
local result = handle:read("*a")
ngx.say("Chaos program has been started...")