Bug 19465: Add --elasticsearch-server option to koha-create
This patch adds the --elasticsearch-server option switch to koha-create. It allows choosing a different Elasticsearch configuration. It defaults to the current 'localhost:9200' value. To test: - Apply this patches - Run: $ reset_all $ man koha-create => SUCCESS: The man page shows correct information about the added option switch - Run: $ sudo koha-create --create-db test => SUCCESS: /etc/koha/sites/test/koha-conf.xml contains the default value (i.e. the current behaviour is kept) - Run: $ sudo koha-create --create-db --elasticsearch-server tomas:1234 test2 => SUCCESS: /etc/koha/sites/test2/koha-conf.xml contains the passed value in the <elasticsearch><server> section. - Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
5d82856f0e
commit
d8c95abe96
|
|
@ -53,6 +53,8 @@ Options:
|
|||
normarc and unimarc.
|
||||
--zebralang lang Choose the primary language for Zebra indexing. Valid
|
||||
values are cs, en (default), es, fr, gr, nb, ru and uk.
|
||||
--elasticsearch-server s Enforce the use of the specified Elasticsearch server(s)
|
||||
(default: localhost:9200).
|
||||
--memcached-servers str Set a comma-separated list of host:port memcached servers.
|
||||
--memcached-prefix str Set the desired prefix for the instance memcached namespace.
|
||||
--enable-sru Enable the Z39.50/SRU server in Zebra search engine
|
||||
|
|
@ -104,6 +106,7 @@ generate_config_file() {
|
|||
-e "s/__DB_HOST__/$mysqlhost/g" \
|
||||
-e "s/__DB_USER__/$mysqluser/g" \
|
||||
-e "s/__DB_PASS__/$mysqlpwd/g" \
|
||||
-e "s/__ELASTICSEARCH_SERVER__/${ELASTICSEARCH_SERVER}/g" \
|
||||
-e "s/__UNIXUSER__/$username/g" \
|
||||
-e "s/__UNIXGROUP__/$username/g" \
|
||||
-e "s#__TEMPLATE_CACHE_DIR__#$TEMPLATE_CACHE_DIR#g" \
|
||||
|
|
@ -341,6 +344,8 @@ PASSWDFILE="/etc/koha/passwd"
|
|||
USE_MEMCACHED="yes"
|
||||
MEMCACHED_SERVERS=""
|
||||
MEMCACHED_PREFIX=""
|
||||
# elasticsearch config
|
||||
ELASTICSEARCH_SERVER="localhost:9200"
|
||||
# hardcoded memcached defaults
|
||||
DEFAULT_MEMCACHED_SERVERS="127.0.0.1:11211"
|
||||
DEFAULT_MEMCACHED_PREFIX="koha_"
|
||||
|
|
@ -374,7 +379,7 @@ fi
|
|||
|
||||
[ $# -ge 1 ] && [ $# -le 16 ] || ( usage ; die "Error: wrong parameters" )
|
||||
|
||||
TEMP=`getopt -o chrpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,enable-sru,sru-port:,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,dbhost:,database:,adminuser:,memcached-servers:,memcached-prefix:,template-cache-dir:,timezone:,upload-path:,tmp-path:,letsencrypt, \
|
||||
TEMP=`getopt -o chrpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,enable-sru,sru-port:,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,dbhost:,database:,elasticsearch-server:,adminuser:,memcached-servers:,memcached-prefix:,template-cache-dir:,timezone:,upload-path:,tmp-path:,letsencrypt, \
|
||||
-n "$0" -- "$@"`
|
||||
|
||||
# Note the quotes around `$TEMP': they are essential!
|
||||
|
|
@ -387,6 +392,7 @@ CLO_DEFAULTSQL=""
|
|||
CLO_ADMINUSER=""
|
||||
CLO_MEMCACHED_SERVERS=""
|
||||
CLO_MEMCACHED_PREFIX=""
|
||||
CLO_ELASTICSEARCH_SERVER=""
|
||||
CLO_UPLOAD_PATH=""
|
||||
CLO_TMP_PATH=""
|
||||
CLO_LETSENCRYPT=""
|
||||
|
|
@ -407,6 +413,8 @@ while true ; do
|
|||
CLO_MEMCACHED_SERVERS="$2" ; shift 2 ;;
|
||||
--memcached-prefix)
|
||||
CLO_MEMCACHED_PREFIX="$2" ; shift 2;;
|
||||
--elasticsearch-server)
|
||||
CLO_ELASTICSEARCH_SERVER="$2" ; shift 2 ;;
|
||||
-m|--marcflavor)
|
||||
CLO_ZEBRA_MARC_FORMAT="$2" ; shift 2 ;;
|
||||
-l|--zebralang)
|
||||
|
|
@ -483,6 +491,10 @@ if [ "$CLO_TIMEZONE" != "" ]; then
|
|||
TIMEZONE=$CLO_TIMEZONE
|
||||
fi
|
||||
|
||||
if [ "${CLO_ELASTICSEARCH_SERVER}" != "" ]; then
|
||||
ELASTICSEARCH_SERVER="${CLO_ELASTICSEARCH_SERVER}"
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_SRU" != "no" ]; then
|
||||
enable_sru_server
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ __END_SRU_PUBLICSERVER__
|
|||
|
||||
<!-- Elasticsearch Configuration -->
|
||||
<elasticsearch>
|
||||
<server>localhost:9200</server> <!-- may be repeated to include all servers on your cluster -->
|
||||
<server>__ELASTICSEARCH_SERVER__</server> <!-- may be repeated to include all servers on your cluster -->
|
||||
<index_name>koha___KOHASITE__</index_name> <!-- should be unique amongst all the indices on your cluster. _biblios and _authorities will be appended. -->
|
||||
</elasticsearch>
|
||||
<!-- Uncomment the following line if you want to override the Elasticsearch default index settings -->
|
||||
|
|
|
|||
Loading…
Reference in New Issue