| 1499 | func Set(key string, value any) { v.Set(key, value) } |
| 1500 | |
| 1501 | func (v *Viper) Set(key string, value any) { |
| 1502 | // If alias passed in, then set the proper override |
| 1503 | key = v.realKey(strings.ToLower(key)) |
| 1504 | value = toCaseInsensitiveValue(value) |
| 1505 | |
| 1506 | path := strings.Split(key, v.keyDelim) |
| 1507 | lastKey := strings.ToLower(path[len(path)-1]) |
| 1508 | deepestMap := deepSearch(v.override, path[0:len(path)-1]) |
| 1509 | |
| 1510 | // set innermost value |
| 1511 | deepestMap[lastKey] = value |
| 1512 | } |
| 1513 | |
| 1514 | // ReadInConfig will discover and load the configuration file from disk |
| 1515 | // and key/value stores, searching in one of the defined paths. |