ardanlabs/conf

FR: Perhaps adding more consistency in variable naming?

pantelis-karamolegkos opened this issue · 1 comments

Following the Service 2.0 class and using the conf package:

▶ ./sales-api --help
Usage: sales-api [options] [arguments]

OPTIONS
 ​--web-api-host/$SALES_WEB_API_HOST                  <string>    (default: 0.0.0.0:3000)
 ​--web-debug-host/$SALES_WEB_DEBUG_HOST              <string>    (default: 0.0.0.0.:4000)
 ​--web-read-timeout/$SALES_WEB_READ_TIMEOUT          <duration>  (default: 5s)
 ​--web-write-timeout/$SALES_WEB_WRITE_TIMEOUT        <duration>  (default: 5s)
 ​--web-shutdown-timeout/$SALES_WEB_SHUTDOWN_TIMEOUT  <duration>  (noprint,default: 5s)
 ​--help/-h                                           
 ​display this help message
 ​--version/-v  
 ​display version information

Perhaps it would be a good idea to have the cmd arguments named exactly (lowercased, hyphens instead of underscores) as the expected env vars, i.e.

--sales-web-api-host/$SALES_WEB_API_HOST

instead of

 ​--web-api-host/$SALES_WEB_API_HOST   

The command line didn’t need the prefix. In fact, I can leave out the prefix in code and they would match. For environment variables I like the prefix.