github.com/turingchain2020/turingchain@v1.1.21/types/chaincfg/cfg.go (about) 1 // Copyright Turing Corp. 2018 All Rights Reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Package chaincfg 实现turingchain的基础配置相关功能 6 package chaincfg 7 8 var configMap = make(map[string]string) 9 10 // Register 注册配置 11 func Register(name, cfg string) { 12 if _, ok := configMap[name]; ok { 13 panic("chain default config name " + name + " is exist") 14 } 15 configMap[name] = cfg 16 } 17 18 // Load 加载指定配置项 19 func Load(name string) string { 20 return configMap[name] 21 } 22 23 // LoadAll 加载所有配置项 24 func LoadAll() map[string]string { 25 return configMap 26 }