Accessing Nameko config from outside a service

I have a helper class manages my database connection, but it is independent
of my nameko services. I would like to access the nameko configuration
from within that class, but I'm not sure how to do this. The closest I can
get is to use the Config DependencyProvider, but I can't access the
ConfigDependency unless I'm within a nameko service.

The flask equivalent of what I'm looking for would be

from flask import current_app

class DBConnection():
    def __init__(self):
        config = current_app.config

I'm not sure I understand the question.

Nameko config is just a dictionary which you can pass around. Could you
read it using the config DependencyProvider
<Built-in Dependency Providers — nameko 2.12.0 documentation;
and then just pass it in to your database helper?

···

On Thursday, April 13, 2017 at 11:50:32 PM UTC+1, di...@clearmetal.com wrote:

I have a helper class manages my database connection, but it is
independent of my nameko services. I would like to access the nameko
configuration from within that class, but I'm not sure how to do this. The
closest I can get is to use the Config DependencyProvider, but I can't
access the ConfigDependency unless I'm within a nameko service.

The flask equivalent of what I'm looking for would be

from flask import current_app

class DBConnection():
    def __init__(self):
        config = current_app.config

I just posted another question that provides a better explanation of why I
would directly want to access the
config: Redirecting to Google Groups

···

On Friday, April 14, 2017 at 9:27:21 AM UTC-7, Matt Yule-Bennett wrote:

I'm not sure I understand the question.

Nameko config is just a dictionary which you can pass around. Could you
read it using the config DependencyProvider
<Built-in Dependency Providers — nameko 2.12.0 documentation;
and then just pass it in to your database helper?

On Thursday, April 13, 2017 at 11:50:32 PM UTC+1, di...@clearmetal.com > wrote:

I have a helper class manages my database connection, but it is
independent of my nameko services. I would like to access the nameko
configuration from within that class, but I'm not sure how to do this. The
closest I can get is to use the Config DependencyProvider, but I can't
access the ConfigDependency unless I'm within a nameko service.

The flask equivalent of what I'm looking for would be

from flask import current_app

class DBConnection():
    def __init__(self):
        config = current_app.config