Skip to content

Commit

Permalink
DO: create ext after reset schema
Browse files Browse the repository at this point in the history
  • Loading branch information
glutamate committed Apr 15, 2021
1 parent 8094b5f commit 476d462
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ EOF
chown saltcorn:saltcorn /home/saltcorn/.config/.saltcorn
chmod 600 /home/saltcorn/.config/.saltcorn
sudo -iu saltcorn /home/saltcorn/.local/bin/saltcorn reset-schema -f
sudo -iu postgres psql -U postgres -d saltcorn -c 'create extension if not exists "uuid-ossp";'
systemctl daemon-reload
systemctl start saltcorn
systemctl enable saltcorn
2 changes: 1 addition & 1 deletion deploy/digitalocean-marketplace/scripts/20-setup
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

sudo -iu postgres psql -U postgres -d template1 -c 'create extension if not exists "uuid-ossp";'
sudo -iu postgres psql -U postgres -c "CREATE USER saltcorn WITH CREATEDB;"

adduser --disabled-password --gecos "" saltcorn
Expand Down
14 changes: 11 additions & 3 deletions packages/server/load_plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ const loadPlugin = async (plugin, force) => {
res.location
);
if (res.plugin_module.onLoad) {
await res.plugin_module.onLoad();
try {
await res.plugin_module.onLoad();
} catch (error) {
console.error(error);
}
}
return res;
};
Expand Down Expand Up @@ -82,7 +86,7 @@ const loadAllPlugins = async () => {
const plugins = await db.select("_sc_plugins");
for (const plugin of plugins) {
try {
const res = await loadPlugin(plugin);
const res = await loadPlugin(plugin);
} catch (e) {
console.error(e);
}
Expand All @@ -105,7 +109,11 @@ const loadAndSaveNewPlugin = async (plugin, force) => {
}
getState().registerPlugin(plugin.name, plugin_module, undefined, location);
if (plugin_module.onLoad) {
await plugin_module.onLoad();
try {
await plugin_module.onLoad();
} catch (error) {
console.error(error);
}
}
if (version) plugin.version = version;
await plugin.upsert();
Expand Down

0 comments on commit 476d462

Please sign in to comment.