79587019

Date: 2025-04-22 16:33:06
Score: 1
Natty:
Report link
  1. install the aforementioned nuget package

  2. Create the builder:

    type Program = class end
    
    [<EntryPoint>]
    let main _ =
        let config =
            ConfigurationBuilder()
                .AddUserSecrets<Program>() 
                .Build()
    
        // config["secrets:your-secret"] 
        0
    

Why do you need a Program class? Shoud we not write idiomatic F#?

F# CLI apps typically just use modules and keep it clean and functional. But AddUserSecrets() expects a class or a type.

Reasons:
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: LaurentBaj