-module(dotenv_gleam). -compile([no_auto_import, nowarn_unused_vars]). -export([config_with/1, config/0]). -spec config_with(binary()) -> nil. config_with(File) -> _assert_subject = gleam@erlang@file:read(File), {ok, Env_file} = case _assert_subject of {ok, _} -> _assert_subject; _assert_fail -> erlang:error(#{gleam_error => let_assert, message => <<"Assertion pattern match failed"/utf8>>, value => _assert_fail, module => <<"dotenv_gleam"/utf8>>, function => <<"config_with"/utf8>>, line => 36}) end, _pipe = gleam@string:split(Env_file, <<"\n"/utf8>>), _pipe@1 = gleam@list:filter(_pipe, fun(Line) -> Line /= <<""/utf8>> end), gleam@list:each( _pipe@1, fun(Line@1) -> Splited_line = gleam@string:split(Line@1, <<"="/utf8>>), Key = begin _pipe@2 = gleam@list:at(Splited_line, 0), _pipe@3 = gleam@result:unwrap(_pipe@2, <<""/utf8>>), gleam@string:trim(_pipe@3) end, Value = begin _pipe@4 = gleam@list:drop(Splited_line, 1), _pipe@5 = gleam@string:join(_pipe@4, <<"="/utf8>>), gleam@string:trim(_pipe@5) end, gleam_erlang_ffi:set_env(Key, Value) end ). -spec config() -> nil. config() -> config_with(<<".env"/utf8>>).