# Alias container key names

**URL:** <https://discourse.dry-rb.org/t/alias-container-key-names/1792>\
**Category:** Support\
**Created:** [April 16, 2024, 11:05pm UTC](https://discourse.dry-rb.org/t/alias-container-key-names/1792 "2024-04-16T23:05:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dlinch](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/dlinch/32/965_2.png) [@dlinch](https://discourse.dry-rb.org/u/dlinch)\
**Post date:** [April 16, 2024, 11:05pm UTC](https://discourse.dry-rb.org/t/alias-container-key-names/1792/1 "2024-04-16T23:05:44Z")

</div>

We are running into a scenario where several different key names would resolve to the same namespace. Specifically, we’re resolving different “flows” with different customers and their unique slugs are the container namespaces. So multiple customers will resolve to the same “flow” we’re outputting in the container.

We are resolving with code that looks a lot like this:

```auto
[name1, name2].each do |name|
  namespace name do 
    register(:key1) { "key" }
  end
end

```

Which is obviously better than:

```auto
namespace :name1 do 
  register(:key1) { "key" }
end

namespace :name2 do
  register(:key1) { "key" }
end

```

But I think this is a reasonable use case that dry-container should handle, I personally like the factorybot syntax for aliases if we’re looking for examples:

```auto
namespace :name1, aliases: [:name2, name3] do
  register(:key1) { "key" }
end

container.resolve('name2.key1') 
=> "key"

```

I tried doing a custom resolver to handle this, but it gets gross pretty quickly when the alias is in an intermediary namespace.
