Skip to content

Commit 854219b

Browse files
committed
Document Redis plugin and allow overruling the use of redis by the IDE.
1 parent 3b72972 commit 854219b

File tree

2 files changed

+58
-2
lines changed

2 files changed

+58
-2
lines changed

config-available/redis.pl

+57-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,58 @@
1+
/* Part of SWISH
2+
3+
Author: Jan Wielemaker
4+
5+
WWW: http://www.swi-prolog.org
6+
Copyright (C): 2020, SWI-Prolog Solutions b.v.
7+
All rights reserved.
8+
9+
Redistribution and use in source and binary forms, with or without
10+
modification, are permitted provided that the following conditions
11+
are met:
12+
13+
1. Redistributions of source code must retain the above copyright
14+
notice, this list of conditions and the following disclaimer.
15+
16+
2. Redistributions in binary form must reproduce the above copyright
17+
notice, this list of conditions and the following disclaimer in
18+
the documentation and/or other materials provided with the
19+
distribution.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24+
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25+
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31+
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32+
POSSIBILITY OF SUCH DAMAGE.
33+
*/
34+
135
:- module(config_redis, []).
36+
37+
/** <module> Configure Redis
38+
39+
SWISH may be configured to use the Redis key-value store for the various
40+
databases. This allows multiple SWISH instances to act as a cluster.
41+
42+
Typically the configuration needs to be edited in two places:
43+
44+
- redis_server/3 must be called to address the Redis server
45+
- redis_consumer may be set to identify this instance. The
46+
default is derived from the host name and port to which
47+
this SWISH instance listens. Clusters are advised to
48+
assign a stable name to each cluster member.
49+
*/
50+
51+
:- multifile swish_config:config/2.
52+
53+
% Do not activate if `config(redis,false)` is present
54+
:- if(\+swish_config:config(ide,true)).
55+
256
:- use_module(swish(lib/config), []).
357
:- use_module(library(redis)).
458
:- use_module(library(settings)).
@@ -9,10 +63,9 @@
963

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

12-
:- multifile swish_config:config/2.
1366
swish_config:config(redis, swish).
1467
swish_config:config(redis_prefix, swish).
15-
%swish_config:config(redis_consumer, alice).
68+
%swish_config:config(redis_consumer, peter).
1669

1770
:- set_setting(user_profile:redis_server, swish).
1871
:- set_setting(user_profile:redis_prefix, 'swish:profiles').
@@ -22,3 +75,5 @@
2275
:- http_set_session_options([ redis_db(swish),
2376
redis_prefix('swish:http:session')
2477
]).
78+
79+
:- endif. % \+swish_config:config(ide,true)

ide.pl

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565

6666
user:file_search_path(project, '.').
6767

68+
swish_config:config(ide, true).
6869
swish_config:config(show_beware, false).
6970
swish_config:config(community_examples, true).
7071

0 commit comments

Comments
 (0)