def __serve_join_script()

in ad-joining/register-computer/main.py [0:0]


def __serve_join_script(request):
    """
    Return the PowerShell script to be run on the joining computer. The script
    does not contain any information about the AD domain or infrastructure so that
    it is safe to provide it without authentication.
    """
    with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), "join.ps1"), 'r') as file:
        join_script = file.read()
        join_script = join_script.replace("%domain%", request.host)
        join_script = join_script.replace("%scheme%", __get_request_scheme(request))

        return flask.Response(join_script, mimetype='text/plain')