Add basic support for virtual apps

This commit is contained in:
AaronDewes 2022-08-23 19:20:50 +00:00
parent 926e863cef
commit b7b76338f3
2 changed files with 9 additions and 0 deletions

View File

@ -143,6 +143,8 @@ def update(verbose: bool = False):
json.dump(registry["metadata"], f, sort_keys=True)
with open(os.path.join(appsDir, "ports.json"), "w") as f:
json.dump(registry["ports"], f, sort_keys=True)
with open(os.path.join(appsDir, "virtual-apps.json"), "w") as f:
json.dump(registry["virtual_apps"], f, sort_keys=True)
print("Wrote registry to registry.json")
os.system("docker pull {}".format(dependencies['app-cli']))

View File

@ -39,6 +39,7 @@ def appPortsToMap():
# Return a list of all app's metadata
def getAppRegistry(apps, app_path):
app_metadata = []
virtual_apps = {}
for app in apps:
app_yml_path = os.path.join(app_path, app, 'app.yml')
if os.path.isfile(app_yml_path):
@ -58,6 +59,11 @@ def getAppRegistry(apps, app_path):
metadata['defaultPassword'] = deriveEntropy("app-{}-seed".format(app))
if "mainContainer" in metadata:
metadata.pop("mainContainer")
if "implements" in metadata:
implements = metadata["implements"]
if implements not in virtual_apps:
virtual_apps[implements] = []
virtual_apps[implements].append(app)
app_metadata.append(metadata)
if version < 3:
getPortsOldApp(app_yml, app)
@ -70,6 +76,7 @@ def getAppRegistry(apps, app_path):
print("App {} is invalid!".format(app))
appPortsToMap()
return {
"virtual_apps": virtual_apps,
"metadata": app_metadata,
"ports": appPortMap
}