from pathlib import Path
import re


def replace_variables(file: str, map: dict):
    """
    Replace ${TOKEN} from file with key/values in map
    """

    with open(Path(file), "r") as f:
        template = f.read()
    for k in map:
        template = re.sub(fr"\${{{k}}}", map[k], template)
    return template