Skip to content

Commit

Permalink
Document Redis plugin and allow overruling the use of redis by the IDE.
Browse files Browse the repository at this point in the history
  • Loading branch information
JanWielemaker committed Dec 4, 2023
1 parent 3b72972 commit 854219b
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
59 changes: 57 additions & 2 deletions config-available/redis.pl
Original file line number Diff line number Diff line change
@@ -1,4 +1,58 @@
/* Part of SWISH
Author: Jan Wielemaker
E-mail: [email protected]
WWW: http://www.swi-prolog.org
Copyright (C): 2020, SWI-Prolog Solutions b.v.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/

:- module(config_redis, []).

/** <module> Configure Redis
SWISH may be configured to use the Redis key-value store for the various
databases. This allows multiple SWISH instances to act as a cluster.
Typically the configuration needs to be edited in two places:
- redis_server/3 must be called to address the Redis server
- redis_consumer may be set to identify this instance. The
default is derived from the host name and port to which
this SWISH instance listens. Clusters are advised to
assign a stable name to each cluster member.
*/

:- multifile swish_config:config/2.

% Do not activate if `config(redis,false)` is present
:- if(\+swish_config:config(ide,true)).

:- use_module(swish(lib/config), []).
:- use_module(library(redis)).
:- use_module(library(settings)).
Expand All @@ -9,10 +63,9 @@

:- redis_server(swish, localhost:6379, []).

:- multifile swish_config:config/2.
swish_config:config(redis, swish).
swish_config:config(redis_prefix, swish).
%swish_config:config(redis_consumer, alice).
%swish_config:config(redis_consumer, peter).

:- set_setting(user_profile:redis_server, swish).
:- set_setting(user_profile:redis_prefix, 'swish:profiles').
Expand All @@ -22,3 +75,5 @@
:- http_set_session_options([ redis_db(swish),
redis_prefix('swish:http:session')
]).

:- endif. % \+swish_config:config(ide,true)
1 change: 1 addition & 0 deletions ide.pl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@

user:file_search_path(project, '.').

swish_config:config(ide, true).
swish_config:config(show_beware, false).
swish_config:config(community_examples, true).

Expand Down

0 comments on commit 854219b

Please sign in to comment.