7 "git.sr.ht/~emersion/go-scfg"
11 * config.Openid.Authorize doesn't have to be specified. But if it is
12 * specified, it replaces the once obtained from the
13 * .well-known/openid-configuration endpoint. Because Microsoft doesn't seem to
14 * want to put their v2.0 authorization endpoint anywhere in their
18 var config_with_pointers
struct {
19 Listen
*string `scfg:"listen"`
20 Url
*string `scfg:"url"`
22 Client
*string `scfg:"client"`
23 Secret
*string `scfg:"secret"`
24 Endpoint
*string `scfg:"endpoint"`
25 Authorize
*string `scfg:"authorize"`
26 Redirect
*string `scfg:"redirect"`
42 func fbfp_get_config(path
string) {
43 f
, err
:= os
.Open(path
)
46 err
= scfg
.NewDecoder(bufio
.NewReader(f
)).Decode(&config_with_pointers
)
50 * TODO: We segfault when there are missing configuration options.
51 * There should be better ways to handle this.
53 config
.Listen
= *(config_with_pointers
.Listen
)
54 config
.Url
= *(config_with_pointers
.Url
)
55 config
.Openid
.Client
= *(config_with_pointers
.Openid
.Client
)
56 config
.Openid
.Endpoint
= *(config_with_pointers
.Openid
.Endpoint
)
57 config
.Openid
.Secret
= *(config_with_pointers
.Openid
.Secret
)
58 config
.Openid
.Redirect
= *(config_with_pointers
.Openid
.Redirect
)
60 if config_with_pointers
.Openid
.Authorize
!= nil {
61 config
.Openid
.Authorize
= *(config_with_pointers
.Openid
.Authorize
)