title: Different packages with different config props - Functional option
body: <p>I have an application which needs configuration and I’ve created a configuration struct and I’m entering the configuration as a parameter to the function. The problem is that the configuration struct becomes bigger (like monolith) and bigger and I move the config to different functions in my app and which doesn’t need all the fields, just few of them. My question is if there is better approach to implement it in Go.</p>
  
  <p>After struggling to find good way I’ve found this article (which a bit old but hopefully still relevant) and I wonder how and if I can use it to solve my problem.</p>
  
  <p>Functional options instead of config struct
  <a href="https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis" rel="noreferrer">https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis</a></p>
  
  <p>I need to inject some configuration properties to my application in </p>
  
  <p>For example for function <code>run</code> (which is entry point ) I need to inject the <code>log level</code> and some other env variable like <code>port</code> <code>host</code> </p>
  
  <p>For function <code>build</code> I need to  “inject” the <code>build flavor</code> and <code>build type</code> etc.</p>
  
  <p>Any example for my content will be very helpful</p>
  
  <ol>
  <li>How to structure it in the code ?</li>
  <li>How to implement it? </li>
  </ol>
  
  <p>update</p>
  
  <p>I need some E2E example how can I use the <strong>functional approach</strong>  for different configs in the same package and other packages</p>