Expose OpenMRS installation directory

core
restws
Tags: #<Tag:0x00007f88c95f00d8> #<Tag:0x00007f88c95fbcd0>

(chine zoheir) #1

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

Cc: @mksd, @dkayiwa


(Daniel Kayiwa) #2

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


(chine zoheir) #3

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()


(Daniel Kayiwa) #4

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


(chine zoheir) #5

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


(Daniel Kayiwa) #6

Yes it always is.


(Dimitri R) #7

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


(Daniel Kayiwa) #8

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


(Dimitri R) #9

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?


(Daniel Kayiwa) #10

You are absolutely correct. :blush:

Do you wanna add that to the? SystemInformationResource1_8


(Dimitri R) #11

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.


(Dimitri R) #12

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.


(Daniel Kayiwa) #13

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.