mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
--plugin-secret support for Heroku
This commit is contained in:
parent
4e5f6b4d11
commit
4c2f4dbd60
1 changed files with 28 additions and 9 deletions
|
|
@ -62,6 +62,30 @@ def publish_subcommand(publish):
|
|||
)
|
||||
call(["heroku", "plugins:install", "heroku-builds"])
|
||||
|
||||
extra_metadata = {
|
||||
"title": title,
|
||||
"license": license,
|
||||
"license_url": license_url,
|
||||
"source": source,
|
||||
"source_url": source_url,
|
||||
"about": about,
|
||||
"about_url": about_url,
|
||||
}
|
||||
|
||||
environment_variables = {}
|
||||
if plugin_secret:
|
||||
extra_metadata["plugins"] = {}
|
||||
for plugin_name, plugin_setting, setting_value in plugin_secret:
|
||||
environment_variable = (
|
||||
"{}_{}".format(plugin_name, plugin_setting)
|
||||
.upper()
|
||||
.replace("-", "_")
|
||||
)
|
||||
environment_variables[environment_variable] = setting_value
|
||||
extra_metadata["plugins"].setdefault(plugin_name, {})[
|
||||
plugin_setting
|
||||
] = {"$env": environment_variable}
|
||||
|
||||
with temporary_heroku_directory(
|
||||
files,
|
||||
name,
|
||||
|
|
@ -73,15 +97,7 @@ def publish_subcommand(publish):
|
|||
static,
|
||||
install,
|
||||
version_note,
|
||||
{
|
||||
"title": title,
|
||||
"license": license,
|
||||
"license_url": license_url,
|
||||
"source": source,
|
||||
"source_url": source_url,
|
||||
"about": about,
|
||||
"about_url": about_url,
|
||||
},
|
||||
extra_metadata,
|
||||
):
|
||||
app_name = None
|
||||
if name:
|
||||
|
|
@ -105,6 +121,9 @@ def publish_subcommand(publish):
|
|||
create_output = check_output(cmd).decode("utf8")
|
||||
app_name = json.loads(create_output)["name"]
|
||||
|
||||
for key, value in environment_variables.items():
|
||||
call(["heroku", "config:set", "-a", app_name, "{}={}".format(key, value)])
|
||||
|
||||
call(["heroku", "builds:create", "-a", app_name, "--include-vcs-ignore"])
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue