{"html_url": "https://github.com/simonw/datasette/pull/432#issuecomment-484584234", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/432", "id": 484584234, "node_id": "MDEyOklzc3VlQ29tbWVudDQ4NDU4NDIzNA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-04-18T16:33:52Z", "updated_at": "2019-04-18T16:33:52Z", "author_association": "OWNER", "body": "It would be nice to decouple the `request` object from the `Facet` class. The request is needed for two things at the moment:\r\n\r\n* To decide if a specific facet bucket has been selected or not\r\n* To construct the `toggle_url` for turning the selection on or off\r\n\r\nCan I pull those needs out of the Facet class somehow?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 432893491, "label": "Refactor facets to a class and new plugin, refs #427"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/434#issuecomment-484694648", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/434", "id": 484694648, "node_id": "MDEyOklzc3VlQ29tbWVudDQ4NDY5NDY0OA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-04-18T21:23:56Z", "updated_at": "2019-04-18T21:23:56Z", "author_association": "OWNER", "body": "Thanks for looking into this!\r\n\r\nTo clarify: currently, the Dockerfile that we generate looks something like this:\r\n\r\n```\r\nCMD [\"datasette\", \"serve\", \"--host\", \"0.0.0.0\", \"fixtures.db\", \"--cors\", \"--port\", \"8001\"]\r\n```\r\n\r\nYour code here changes that CMD line to look like this instead, in order to set the port based on an environment variable:\r\n\r\n```\r\nCMD [\"sh\", \"-c\", \"datasette serve --port $PORT ...\"]\r\n```\r\n\r\nI wonder if this is the only way to do this?\r\n\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 434321685, "label": "\"datasette publish cloudrun\" command to publish to Google Cloud Run"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/pull/434#issuecomment-484699119", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/434", "id": 484699119, "node_id": "MDEyOklzc3VlQ29tbWVudDQ4NDY5OTExOQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2019-04-18T21:40:45Z", "updated_at": "2019-04-18T21:40:45Z", "author_association": "OWNER", "body": "I asked @andrewgodwin about this and he confirmed that if we want to read an environment variable we can't use the `CMD [...]` syntax in the way that we were using it.\r\n\r\nHe did suggest that if we're doing `CMD [\"sh\", \"-c\", \"datasette serve --port $PORT ...\"]` we may as well do this instead:\r\n\r\n`CMD \"datasette serve --port $PORT ...\"`\r\n\r\nWe should apply some command-line escaping here - if the user passes `--version-note=hello$there` to `datasette publish` we need that $ not to be accidentally evaluated as an environment variable.\r\n\r\nIt looks like [shlex.quote](https://docs.python.org/dev/library/shlex.html#shlex.quote) is the right way to do that.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 434321685, "label": "\"datasette publish cloudrun\" command to publish to Google Cloud Run"}, "performed_via_github_app": null}