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.

Provide different kind of service implement if some condition is met or not

See original GitHub issue

Hello,

I’ve searched through you’re documentation but it seems not be possible at the moment to provide specific implementation of a service whenever we reach a certain condition with a value coming from a property file.

What I am intending to do with that is something like:

Hey, is there a properties in your .ini file set to this value ? Okay, then service implementation is A, otherwise it should be B

Here’s what I am trying to do: https://gist.github.com/MadJlzz/22f977a6fd91e48d3c120dd9de9510f9

I know it is not working but I guess you will understand what I’ve tried to do. I’ve also understand that providers.Configuration is to load properties from a file and inject those inside one of the dependencies we are wishing to create. (so bad use in my example)

If not possible at the moment, it could be a nice feature, no?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rmk135commented, Dec 2, 2020

No problems, you’re welcome.

Most of the examples and providers take their origin from the issues like that. Thanks for raising that one. That’s not a bad idea to have an example with Selector provider better promoted.

Feel free to open another one if you see something not working, or not clear, or you just need an advice.

0reactions
MadJlzzcommented, Dec 2, 2020

Okay, I guess I really need to clean my glasses before creating an issue. Thanks a lot for the support!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Excel IF function with multiple conditions - Ablebits
The tutorial shows how to create multiple IF statements in Excel with AND as well as OR logic. Also, you will learn how...
Read more >
MySQL: update a field only if condition is met - Stack Overflow
UPDATE test SET something = 1, field = IF(condition is true, 1, field) WHERE id = 123 ... Another solution we can use...
Read more >
Conditional Logic for Online Forms - Jotform
Smart forms function according to if-then conditions. For instance, if a user is paying for a subscription, then they will be asked about...
Read more >
Everything you wanted to know about the if statement
The most common use of the if statement for is comparing two items with each other. PowerShell has special operators for different ......
Read more >
How To Write Conditional Statements in JavaScript
As an example, you might want a form to submit if each field is filled out ... Since the if condition did not...
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