# How read config env in an other config file?

**URL:** <https://erlangforums.com/t/how-read-config-env-in-an-other-config-file/3837>\
**Category:** Questions / Help\
**Tags:** configs\
**Created:** [July 17, 2024, 3:52am UTC](https://erlangforums.com/t/how-read-config-env-in-an-other-config-file/3837 "2024-07-17T03:52:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wangcw](https://erlangforums.com/user_avatar/erlangforums.com/wangcw/32/2065_2.png) [@wangcw](https://erlangforums.com/u/wangcw)\
**Post date:** [July 17, 2024, 3:52am UTC](https://erlangforums.com/t/how-read-config-env-in-an-other-config-file/3837/1 "2024-07-17T03:52:05Z")

</div>

help me about an issue:

rebar3.config

```erlang

{relx, [{release, []

[sasl]},

{mode, minimal},

{extended_start_script, true},

{sys_config, "config/sys.config"},

{vm_args, "config/vm.args"},

{overlay, [{copy, "config/prod_db.config", "releases/0.1.10/prod_db.config"}]}

]}.

{profiles, [{prod, [{relx, [

{mode, prod},

{extended_start_script, true},

{sys_config_src, "config/sys.config.src"},

{vm_args_src, "config/vm.args.src"}

]}

]}

]}.

{shell, [

{config, "config/dev_sys.config.src"}

]}.

sys.config.src

["prod_db",

{nova, {123}}

]

```

app.src

```erlang

{application, 11,

[{description, "11"},

{vsn, "0.1.0"},

{registered, []},

{mod, {11_app, []}},

{included_applications, []},

{applications,

[kernel,

stdlib

]},

{env,[]},

{modules, []}

]}.

```

prod\_db.config

```erlang

[{pgpool, [

{pools, [

{pool_db, [

{size, 2},

{connection_options, [

{host, "localhost"},

{user, "root"},

{port, 3306},

{password, "123456"},

{database, "testdb"},

{keep_alive, true},

{connect_timeout, 18000}

]}

]}

]}

]}

].

```

When I print the environment variables in app\_sup

```erlang

lager:info("All database connection parameters: ~p~n", [application:get_all_env(pgpool)]),

lager:info("All nova parameters: ~p~n", [application:get_all_env(nova)]),

```

The first database connection address is always read as empty , while the second one prints the actual result.

Even after moving the configuration in prod\_db.conf to sys.config.src, it still cannot be read.

Why is this?

---

<div class="post-metadata">

**Author:** ![wangcw](https://erlangforums.com/user_avatar/erlangforums.com/wangcw/32/2065_2.png) [@wangcw](https://erlangforums.com/u/wangcw)\
**Post date:** [July 17, 2024, 3:57am UTC](https://erlangforums.com/t/how-read-config-env-in-an-other-config-file/3837/2 "2024-07-17T03:57:02Z")

</div>

sorry for ask this question, i find it … need add a  
my\_app{} outside

---

<div class="post-metadata">

**Author:** ![leeyis](https://erlangforums.com/user_avatar/erlangforums.com/leeyis/32/1191_2.png) [@leeyis](https://erlangforums.com/u/leeyis)\
**Post date:** [July 18, 2024, 3:29am UTC](https://erlangforums.com/t/how-read-config-env-in-an-other-config-file/3837/3 "2024-07-18T03:29:41Z")

</div>

The following method is effective？

```erlang
application:get_env(App, Attr)

```

---

<div class="post-metadata">

**Author:** ![wangcw](https://erlangforums.com/user_avatar/erlangforums.com/wangcw/32/2065_2.png) [@wangcw](https://erlangforums.com/u/wangcw)\
**Post date:** [July 18, 2024, 3:34am UTC](https://erlangforums.com/t/how-read-config-env-in-an-other-config-file/3837/4 "2024-07-18T03:34:47Z")

</div>

Sorry, I didn’t reply earlier. In the prod\_db.conf file, I changed the top-level node from `pgpool` to `epgsql`, and then I was able to read the configuration information.
