dokku-compose 0.6.13 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +32 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -893,8 +893,38 @@ async function destroyServices(ctx, services) {
|
|
|
893
893
|
logDone();
|
|
894
894
|
}
|
|
895
895
|
}
|
|
896
|
-
|
|
897
|
-
|
|
896
|
+
var SERVICE_PLUGINS = ["postgres", "redis"];
|
|
897
|
+
async function exportServices(ctx) {
|
|
898
|
+
const services = {};
|
|
899
|
+
const pluginOutput = await ctx.query("plugin:list");
|
|
900
|
+
const installedPlugins = new Set(
|
|
901
|
+
pluginOutput.split("\n").map((line) => line.trim().split(/\s+/)[0]).filter(Boolean)
|
|
902
|
+
);
|
|
903
|
+
for (const plugin of SERVICE_PLUGINS) {
|
|
904
|
+
if (!installedPlugins.has(plugin)) continue;
|
|
905
|
+
const listOutput = await ctx.query(`${plugin}:list`);
|
|
906
|
+
const lines = listOutput.split("\n").slice(1);
|
|
907
|
+
for (const line of lines) {
|
|
908
|
+
const name = line.trim().split(/\s+/)[0];
|
|
909
|
+
if (!name) continue;
|
|
910
|
+
const infoOutput = await ctx.query(`${plugin}:info`, name);
|
|
911
|
+
const versionMatch = infoOutput.match(/Version:\s+(\S+)/);
|
|
912
|
+
if (!versionMatch) continue;
|
|
913
|
+
const versionField = versionMatch[1];
|
|
914
|
+
const colonIdx = versionField.lastIndexOf(":");
|
|
915
|
+
const config = { plugin };
|
|
916
|
+
if (colonIdx > 0) {
|
|
917
|
+
const image = versionField.slice(0, colonIdx);
|
|
918
|
+
const version2 = versionField.slice(colonIdx + 1);
|
|
919
|
+
if (image !== plugin) config.image = image;
|
|
920
|
+
if (version2) config.version = version2;
|
|
921
|
+
} else {
|
|
922
|
+
config.version = versionField;
|
|
923
|
+
}
|
|
924
|
+
services[name] = config;
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
return services;
|
|
898
928
|
}
|
|
899
929
|
async function exportAppLinks(ctx, app, services) {
|
|
900
930
|
const linked = [];
|