question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to handle several container scenarios?

See original GitHub issue

Is your feature request related to a problem? Please describe. I have a use case where I need to be able to manage multiple containers each with specific settings. By settings I mean a different object to inject to the last nested object.

Description To do so It would be very great if we could instantiate containers this way:

let container1 = new Container();
let container2 = new Container();

And then ā€œattachā€ the settings object (in my use case) to containers like this:

container1.register("SettingsClass", {
  provider: () => settingsObject1
});
container2.register("SettingsClass", {
  provider: () => settingsObject2
});

So when resolving objects the right settingsObject1 will be injected and successfully get

const myService1 = container1.resolve(MyService);
const myService2 = container2.resolve(MyService);

Maybe there is already a way to do it but I could not find it, could you help me? PS: I’m a noob in typescript 😃

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
MeltingMosaiccommented, Jul 23, 2019

@Xapphire13 I’m in the process of updating the documentation - what exactly needs to be documented here? That you can have multiple containers, or that you can have containers with fallback using createChildContainer()?

Edit: I see - we have no documentation on containers at all.

1reaction
fab971commented, Jul 15, 2019

Ok thank you, it’s perfect šŸ‘Œ

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding Container Scenarios and Overview of Docker
The main purpose of application containers is to package different component of the application in separate container. The different componentĀ ...
Read more >
Run multiple services in a container | Docker Documentation
Run multiple services in a container. A container's main running process is the ENTRYPOINT and/or CMD at the end of the Dockerfile ....
Read more >
Containers: one single process, or multiple processes?
If you need to run multiple processes, it's generally recommended to place each process in its own container. You can run multiple containers...
Read more >
Kubernetes multi-container pods and container communication
Some examples include log or data change watchers, monitoring adapters, and so on. A log watcher, for example, can be built once by...
Read more >
Container Tidbits: When Should I Break My Application into ...
In reality, many applications use multiple processes per container. The Apache Web Server prefork and MPM modules both use multiple processesĀ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found