openfaas / connector-sdk

SDK for connecting events to functions
MIT License
54 stars 25 forks source link

[Proposal] Add ReadFromEnv for the controller config #49

Open LucasRoesler opened 4 years ago

LucasRoesler commented 4 years ago

My actions before raising this issue

I would like to propose adding a Read/GetFromEnv to the connector-sdk here https://github.com/openfaas-incubator/connector-sdk/blob/df5d76475412b74c3516ba912ae4522793780994/types/controller.go#L17 similar to how we did it in the faas-provider https://github.com/openfaas/faas-provider/blob/d6579bdcf7c85f4d01f398d65ea0cab37e9633d0/types/read_config.go#L77 , so that PRs like this https://github.com/openfaas-incubator/nats-connector/pull/3 that copy the config from one location to another are not needed. If you update the SDK and the config changes, the propogation of the new config should be automatic. Copying config from one struct to another going to to be bug prone.

This would make configuration consistent in the various connectors and simplify upgrades downstream.