<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def init(directory):
 """Init the config fle."""

    username = click.prompt("Input your username")
    password = click.prompt("Input your password", hide_input=True,
                            confirmation_prompt=True)
    log_directory = click.prompt("Input your log directory")

    if not path.exists(log_directory):
        sys.exit("Invalid log directory, please have a check.")

    config_file_path = path.join(directory, 'v2ex_config.json')
    config = {
        "username": username,
        "password": password,
        "log_directory": path.abspath(log_directory)
    }
    with open(config_file_path, 'w') as f:
        json.dump(config, f)
    click.echo("Init the config file at: {0}".format(config_file_path))