|
| 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 | + |
1 | 35 | :- 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 | + |
2 | 56 | :- use_module(swish(lib/config), []).
|
3 | 57 | :- use_module(library(redis)).
|
4 | 58 | :- use_module(library(settings)).
|
|
9 | 63 |
|
10 | 64 | :- redis_server(swish, localhost:6379, []).
|
11 | 65 |
|
12 |
| -:- multifile swish_config:config/2. |
13 | 66 | swish_config:config(redis, swish).
|
14 | 67 | swish_config:config(redis_prefix, swish).
|
15 |
| -%swish_config:config(redis_consumer, alice). |
| 68 | +%swish_config:config(redis_consumer, peter). |
16 | 69 |
|
17 | 70 | :- set_setting(user_profile:redis_server, swish).
|
18 | 71 | :- set_setting(user_profile:redis_prefix, 'swish:profiles').
|
|
22 | 75 | :- http_set_session_options([ redis_db(swish),
|
23 | 76 | redis_prefix('swish:http:session')
|
24 | 77 | ]).
|
| 78 | + |
| 79 | +:- endif. % \+swish_config:config(ide,true) |
0 commit comments