Expose OpenMRS installation directory

we would like to expose the OpenMRS Installation directory path as part of the systeminformation rest resource, any objections/ideas?

Cc: @mksd, @dkayiwa

2 Likes

Do you mean the one referred to as “Local repository” here? https://demo.openmrs.org/openmrs/admin/maintenance/systemInfo.htm

the one referred as “Local repository” is the directory path to modules which in this case looks a subfolder of the installation path that could be get programmatically by :

OpenmrsUtil.getApplicationDataDirectory()

If you took off “modules”, doesn’t that give you what you need?

In most cases the answer is Yes, but i’m wondering is the modules’ path is always a sub folder of the installation directory ?

Yes it always is.

1 Like

@dkayiwa are we sure? Isn’t this defined by a runtime property? See here.

What i mean is that whatever value is set there, it would be retrievable using a consistent API.

What @zouchine is after is the app data directory path. While it is unlikely to happen, it is possible that the modules dir path minus /modules is not the path of the app data directory right?

Or do you know of another web API that might return the app data dir path?

You are absolutely correct. :blush:

Do you wanna add that to the? SystemInformationResource1_8

Your suggestion solution will work perfectly fine for the time being, we had already decided to do that for now.

But for the longer run/better solution, do you see any downside in exposing the app data dir path through sysinfo? If not then @zouchine will open a ticket for it.

I think that resource just returns what comes out of sysinfo anyway, it doesn’t really post-process it, see here:

SimpleObject rest = new SimpleObject();
rest.put("systemInfo", Context.getAdministrationService().getSystemInformation());
return rest;

So we are rather thinking of expanding what getSystemInformation() returns.

1 Like

Expanding the system information API to include such, looks fair enough. Since it is already accessible to only those that have the “View Administration Functions” privilege.

2 Likes