How to configure NimbleCSV dynamically

Currently what I’m doing is totally wrong.

 defp config_parser_and_return_file_path(config) do
    params = config["params"]
    csv_sep = params["sep"] |> config_seperator
    csv_delimiter = params["delimiter"] |> config_escape_char

    IO.inspect "seperator #{csv_sep}, escape #{csv_delimiter}"  

        |> NimbleCSV.define(separator: csv_sep, escape: csv_delimiter)

  defp config_seperator(""), do: "\t"
  defp config_seperator("\\t"), do: "\t"
  defp config_seperator(csv_sep), do: csv_sep

  defp config_escape_char(""), do: "|"
  defp config_escape_char(csv_delimiter), do: csv_delimiter

But I have a multi tenant app where the csv format can be different. So I have to do this in code.