+
+def setup_config():
+ rails_api_port = find_available_port()
+ controller_port = find_available_port()
+ controller_external_port = find_available_port()
+ websocket_port = find_available_port()
+ websocket_external_port = find_available_port()
+ git_httpd_port = find_available_port()
+ git_httpd_external_port = find_available_port()
+ keepproxy_port = find_available_port()
+ keepproxy_external_port = find_available_port()
+ keep_web_port = find_available_port()
+ keep_web_external_port = find_available_port()
+ keep_web_dl_port = find_available_port()
+ keep_web_dl_external_port = find_available_port()
+
+ dbconf = os.path.join(os.environ["CONFIGSRC"], "config.yml")
+
+ print("Getting config from %s" % dbconf, file=sys.stderr)
+
+ pgconnection = yaml.safe_load(open(dbconf))["Clusters"]["zzzzz"]["PostgreSQL"]["Connection"]
+
+ localhost = "127.0.0.1"
+ services = {
+ "RailsAPI": {
+ "InternalURLs": {
+ "https://%s:%s"%(localhost, rails_api_port): {}
+ }
+ },
+ "Controller": {
+ "ExternalURL": "https://%s:%s" % (localhost, controller_external_port),
+ "InternalURLs": {
+ "http://%s:%s"%(localhost, controller_port): {}
+ }
+ },
+ "Websocket": {
+ "ExternalURL": "wss://%s:%s/websocket" % (localhost, websocket_external_port),
+ "InternalURLs": {
+ "http://%s:%s"%(localhost, websocket_port): {}
+ }
+ },
+ "GitHTTP": {
+ "ExternalURL": "https://%s:%s" % (localhost, git_httpd_external_port),
+ "InternalURLs": {
+ "http://%s:%s"%(localhost, git_httpd_port): {}
+ }
+ },
+ "Keepproxy": {
+ "ExternalURL": "https://%s:%s" % (localhost, keepproxy_external_port),
+ "InternalURLs": {
+ "http://%s:%s"%(localhost, keepproxy_port): {}
+ }
+ },
+ "WebDAV": {
+ "ExternalURL": "https://%s:%s" % (localhost, keep_web_external_port),
+ "InternalURLs": {
+ "http://%s:%s"%(localhost, keep_web_port): {}
+ }
+ },
+ "WebDAVDownload": {
+ "ExternalURL": "https://%s:%s" % (localhost, keep_web_dl_external_port),
+ "InternalURLs": {
+ "http://%s:%s"%(localhost, keep_web_dl_port): {}
+ }
+ }
+ }
+
+ config = {
+ "Clusters": {
+ "zzzzz": {
+ "EnableBetaController14287": ('14287' in os.environ.get('ARVADOS_EXPERIMENTAL', '')),
+ "ManagementToken": "e687950a23c3a9bceec28c6223a06c79",
+ "API": {
+ "RequestTimeout": "30s"
+ },
+ "SystemLogs": {
+ "LogLevel": ('info' if os.environ.get('ARVADOS_DEBUG', '') in ['','0'] else 'debug')
+ },
+ "PostgreSQL": {
+ "Connection": pgconnection,
+ },
+ "TLS": {
+ "Insecure": True
+ },
+ "Services": services
+ }
+ }
+ }
+
+ conf = os.path.join(TEST_TMPDIR, 'arvados.yml')
+ with open(conf, 'w') as f:
+ yaml.safe_dump(config, f)
+
+ ex = "export ARVADOS_CONFIG="+conf
+ print(ex)
+