feat: properly export env vars for cnb apps

They are not baked into the image like they are for herokuish, so we need to manually set them via --env. Additionally, due to newline constraints in docker, we need to use `--env=key` format to correctly pull the values into place.
This commit is contained in:
Jose Diaz-Gonzalez
2021-02-11 03:52:02 -05:00
parent 5921692f83
commit 812e34c6f5
5 changed files with 48 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
import http.server
import json
import os
@@ -7,7 +8,12 @@ class GetHandler(http.server.BaseHTTPRequestHandler):
self.send_response(200)
self.send_header("Content-Type", "text/plain; charset=utf-8")
self.end_headers()
self.wfile.write("python/http.server".encode("utf-8"))
if self.path == '/':
self.wfile.write("python/http.server".encode("utf-8"))
else:
data = json.dumps(dict(os.environ), sort_keys=True, indent=4)
self.wfile.write(data.encode("utf-8"))
if __name__ == "__main__":