erddap icon indicating copy to clipboard operation
erddap copied to clipboard

Code uses emailDailyReportTo, documentation references emailDailyReportsTo

Open srstsavage opened this issue 1 year ago • 1 comments

For the emailDailyReportTo setting, there is a mismatch between the EDStatic code reading setup.xml or environment variables (which references emailDailyReportTo) and the setup.xml documentation (which references emailDailyReportsTo).

EDStatic code reading emailDailyReportTo:

https://github.com/ERDDAP/erddap/blob/main/WEB-INF/classes/gov/noaa/pfel/erddap/util/EDStatic.java#L1843

Various documentation/comments referencing emailDailyReportsTo:

https://github.com/search?q=repo%3AERDDAP%2Ferddap%20emailDailyReportsTo&type=code https://github.com/ERDDAP/erddapContent/blob/main/content/erddap/setup.xml#L56 https://github.com/ERDDAP/erddapContent/blob/main/content/erddap/setup.xml#L69

These should be aligned, or EDStatic should be adjusted to accept both the singular and plural.

srstsavage avatar Jun 28 '24 14:06 srstsavage

I think making EDStatic accept both would be the better solution.

ChrisJohnNOAA avatar Jun 28 '24 15:06 ChrisJohnNOAA

To confirm if I understand this:

In setup.xml the tag is emailDailyReportsTo but EDStatic is trying to get emailDailyReportTo instead, which I assume is a typo? If that is the case then in this code here

  private static String getSetupEVString(
      ResourceBundle2 setup, Map<String, String> ev, String paramName, String tDefault) {
    String value = ev.get("ERDDAP_" + paramName);
    if (String2.isSomething(value)) {
      String2.log("got " + paramName + " from ERDDAP_" + paramName);
      return value;
    }
    return setup.getString(paramName, tDefault);
  }

setup.getString() would always return null since emailDailyReportTo does not exist in setup.xml file and only the ev.get() method is working.

Why don't we just update it to emailDailyReportsTo in this line

emailDailyReportToCsv =
          getSetupEVString(setup, ev, "emailDailyReportTo", ""); // won't be null

is it important to support both emailDailyReportsTo and emailDailyReportTo?

ayushsingh01042003 avatar Dec 10 '24 16:12 ayushsingh01042003

It would be good to support both emailDailyReportsTo and emailDailyReportTo. Users have their own setup.xml and some likely followed the documentation and set emailDailyReportsTo while some may have figured out the proper name is emailDailyReportTo.

The reason to support both is to not break folks current set up. Especially because this is a circumstance it's very easy to support both (read emailDailyReportTo and if that is not set, then read emailDailyReportsTo).

ChrisJohnNOAA avatar Dec 10 '24 17:12 ChrisJohnNOAA

There is also the line https://github.com/ERDDAP/erddap/blob/main/src/browser/gov/noaa/pfel/coastwatch/OneOf.java#L255 which I am not sure is something related or to be changed here

ayushsingh01042003 avatar Dec 11 '24 06:12 ayushsingh01042003

There is also the line https://github.com/ERDDAP/erddap/blob/main/src/browser/gov/noaa/pfel/coastwatch/OneOf.java#L255 which I am not sure is something related or to be changed here

That does not need to be changed. That was code to support an old feature that is not used.

ChrisJohnNOAA avatar Dec 11 '24 16:12 ChrisJohnNOAA

I think this can be closed with the merge of https://github.com/ERDDAP/erddap/pull/236

ayushsingh01042003 avatar Dec 12 '24 14:12 ayushsingh01042003

Yes, this will be in the next release (2.26), which is targeted for late January.

ChrisJohnNOAA avatar Dec 12 '24 16:12 ChrisJohnNOAA