Parcourir la source

fix #2007 add mail.hostname

Shinsuke Sugaya il y a 6 ans
Parent
commit
9a691cdcba

+ 5 - 1
src/main/java/org/codelibs/fess/exec/Crawler.java

@@ -381,7 +381,11 @@ public class Crawler {
                 dataMap.put(StringUtil.decapitalize(entry.getKey()), entry.getValue());
             }
 
-            dataMap.put("hostname", ComponentUtil.getSystemHelper().getHostname());
+            String hostname = fessConfig.getMailHostname();
+            if (StringUtil.isBlank(hostname)) {
+                hostname = ComponentUtil.getSystemHelper().getHostname();
+            }
+            dataMap.put("hostname", hostname);
 
             logger.debug("\ninfoMap: {}\ndataMap: {}", infoMap, dataMap);
 

+ 27 - 0
src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java

@@ -989,6 +989,9 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
     /** The key of the configuration. e.g. root@localhost */
     String MAIL_FROM_ADDRESS = "mail.from.address";
 
+    /** The key of the configuration. e.g.  */
+    String MAIL_HOSTNAME = "mail.hostname";
+
     /** The key of the configuration. e.g.  */
     String SCHEDULER_TARGET_NAME = "scheduler.target.name";
 
@@ -4681,6 +4684,21 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
      */
     String getMailFromAddress();
 
+    /**
+     * Get the value for the key 'mail.hostname'. <br>
+     * The value is, e.g.  <br>
+     * @return The value of found property. (NotNull: if not found, exception but basically no way)
+     */
+    String getMailHostname();
+
+    /**
+     * Get the value for the key 'mail.hostname' as {@link Integer}. <br>
+     * The value is, e.g.  <br>
+     * @return The value of found property. (NotNull: if not found, exception but basically no way)
+     * @throws NumberFormatException When the property is not integer.
+     */
+    Integer getMailHostnameAsInteger();
+
     /**
      * Get the value for the key 'scheduler.target.name'. <br>
      * The value is, e.g.  <br>
@@ -7634,6 +7652,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
             return get(FessConfig.MAIL_FROM_ADDRESS);
         }
 
+        public String getMailHostname() {
+            return get(FessConfig.MAIL_HOSTNAME);
+        }
+
+        public Integer getMailHostnameAsInteger() {
+            return getAsInteger(FessConfig.MAIL_HOSTNAME);
+        }
+
         public String getSchedulerTargetName() {
             return get(FessConfig.SCHEDULER_TARGET_NAME);
         }
@@ -8636,6 +8662,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
             defaultMap.put(FessConfig.USER_CODE_PATTERN, "[a-zA-Z0-9_]+");
             defaultMap.put(FessConfig.MAIL_FROM_NAME, "Administrator");
             defaultMap.put(FessConfig.MAIL_FROM_ADDRESS, "root@localhost");
+            defaultMap.put(FessConfig.MAIL_HOSTNAME, "");
             defaultMap.put(FessConfig.SCHEDULER_TARGET_NAME, "");
             defaultMap.put(FessConfig.SCHEDULER_JOB_CLASS, "org.codelibs.fess.app.job.ScriptExecutorJob");
             defaultMap.put(FessConfig.SCHEDULER_CONCURRENT_EXEC_MODE, "QUIT");

+ 1 - 0
src/main/resources/fess_config.properties

@@ -521,6 +521,7 @@ user.code.pattern=[a-zA-Z0-9_]+
 # From
 mail.from.name = Administrator
 mail.from.address = root@localhost
+mail.hostname=
 
 # ----------------------------------------------------------
 #                                                  Scheduler