blob: 65acd874b426bb6426e04a384d59aa96272c3f0e [file] [log] [blame]
Wei-Yu Chen49950b92021-11-08 19:19:18 +08001"""
2Copyright 2020 The Magma Authors.
3
4This source code is licensed under the BSD-style license found in the
5LICENSE file in the root directory of this source tree.
6
7Unless required by applicable law or agreed to in writing, software
8distributed under the License is distributed on an "AS IS" BASIS,
9WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10See the License for the specific language governing permissions and
11limitations under the License.
12"""
13import redis
14from configuration.service_configs import get_service_config_value
15
16
17def get_default_client():
18 """
19 Return a default redis client using the configured port in redis.yml
20 """
21 redis_port = get_service_config_value('redis', 'port', 6379)
22 redis_addr = get_service_config_value('redis', 'bind', 'localhost')
23 return redis.Redis(host=redis_addr, port=redis_port)