# \[dry-container\] Resolve from another namespace

**URL:** <https://discourse.dry-rb.org/t/dry-container-resolve-from-another-namespace/723>\
**Category:** Support\
**Created:** [February 20, 2019, 10:33am UTC](https://discourse.dry-rb.org/t/dry-container-resolve-from-another-namespace/723 "2019-02-20T10:33:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![niels-s](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/niels-s/32/344_2.png) [@niels-s](https://discourse.dry-rb.org/u/niels-s)\
**Post date:** [February 20, 2019, 10:33am UTC](https://discourse.dry-rb.org/t/dry-container-resolve-from-another-namespace/723/1 "2019-02-20T10:33:10Z")

</div>

Hey there,

we’ve been using dry-container for a while now and it’s great. But we’ve stumbled into a “issue” which I would like to discuss and see if it’s possible to get it working. We got the following situation:

```
...
namespace('config') do
  register('database_url') { ENV.fetch('DATABASE_URL') }
end

namespace('databases') do
  register('postgres', memoize: true) { Sequel.connect(resolve('config.database_url')) }
end
...

```

Now when we run this the `config.database_url` is resolved to `databases.config.database_url` instead. Is there a possible way to get the database\_url from the right namespace without the nested `databases`?

When I look up the [namespace dsl](https://github.com/dry-rb/dry-container/blob/master/lib/dry/container/namespace_dsl.rb#L49) I noticed the `resolve` method always namespaces a key. So I assume there is no work around.

---

<div class="post-metadata">

**Author:** ![niels-s](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/niels-s/32/344_2.png) [@niels-s](https://discourse.dry-rb.org/u/niels-s)\
**Post date:** [February 20, 2019, 12:29pm UTC](https://discourse.dry-rb.org/t/dry-container-resolve-from-another-namespace/723/2 "2019-02-20T12:29:52Z")

</div>

I’ve created a PR to solve my issue: [https://github.com/dry-rb/dry-container/pull/55](https://github.com/dry-rb/dry-container/pull/55)
