Skip to content

Allow ThingServer.__init__ to accept a config model instance #295

@rwb27

Description

@rwb27

Is your feature request related to a problem? Please describe.
ThingServer.__init__ has several arguments that are passed internally to ThingServerConfig(). Currently, the only way to use an instance of ThingServerConfig is to pass it to ThingServer.from_config which dumps it to a dictionary and then re-creates it in ThingServer.__init__.

This results in several places that all list the arguments to ThingServerConfig and some ugly code.

Describe the solution you'd like
ThingServer.__init__ should be able to accept a ThingServerConfig which is then used directly, without further processing. It should still be able to accept things and other arguments, probably using **kwargs.

Mostly, this just deduplicates the code, but it also means that subclassed config models will stay as instances of the subclass, rather than reverted to a base ThingServerConfig instance. This ought to make life easier for downstream code that wants to define a model for application_config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions