Home | History | Annotate | Line # | Download | only in vars
      1 # Copyright (C) Internet Systems Consortium, Inc. ("ISC")
      2 #
      3 # SPDX-License-Identifier: MPL-2.0
      4 #
      5 # This Source Code Form is subject to the terms of the Mozilla Public
      6 # License, v. 2.0.  If a copy of the MPL was not distributed with this
      7 # file, you can obtain one at https://mozilla.org/MPL/2.0/.
      8 #
      9 # See the COPYRIGHT file distributed with this work for additional
     10 # information regarding copyright ownership.
     11 
     12 from pathlib import Path
     13 from typing import Dict
     14 
     15 
     16 def load_ac_vars_from_files() -> Dict[str, str]:
     17     ac_vars = {}
     18     ac_vars_dir = Path(__file__).resolve().parent / ".ac_vars"
     19     var_paths = [
     20         path
     21         for path in ac_vars_dir.iterdir()
     22         if path.is_file() and not path.name.endswith(".in")
     23     ]
     24     for var_path in var_paths:
     25         ac_vars[var_path.name] = var_path.read_text(encoding="utf-8").strip()
     26     return ac_vars
     27 
     28 
     29 AC_VARS = load_ac_vars_from_files()
     30