MCPcopy Create free account
hub / github.com/supabase/auth / loadFile

Method loadFile

internal/conf/confload/loader.go:116–138  ·  view source on GitHub ↗
(dst map[string]string, file string)

Source from the content-addressed store, hash-verified

114}
115
116func (o *Loader) loadFile(dst map[string]string, file string) error {
117 // If a cfg file is set we read the file and copy directly into dst
118 if file != "" {
119 return o.readFile(file, dst)
120 }
121
122 // Otherwise we need to mimic the current behavior of godotenv and
123 // look for a .env file.
124 //
125 // TODO(cstockton): I would prefer to remove the .env loading without some
126 // explicit devmode / local flag, or a way to disable via an option passed
127 // from the CLI.
128 buf := make(map[string]string)
129 if err := o.readFile(".env", buf); err != nil {
130 if errors.Is(err, os.ErrNotExist) {
131 return nil // current behavior is to ignore errors loading .env
132 }
133 return err
134 }
135
136 o.merge(dst, buf, false)
137 return nil
138}
139
140func (o *Loader) merge(dst, src map[string]string, override bool) {
141 if override {

Callers 1

startupMethod · 0.95

Calls 3

readFileMethod · 0.95
mergeMethod · 0.95
IsMethod · 0.45

Tested by

no test coverage detected