当前位置: 首页 > news >正文

濮阳做网站企点下载

濮阳做网站,企点下载,wordpress微信查看密码破解,网站开发 鲁山简介 应用提倡将配置存储在环境变量中。任何从开发环境切换到生产环境时需要修改的东西都从代码抽取到环境变量里。 但是在实际开发中,如果同一台机器运行多个项目,设置环境变量容易冲突,不实用。godotenv库从.env文件中读取配置,…

简介
应用提倡将配置存储在环境变量中。任何从开发环境切换到生产环境时需要修改的东西都从代码抽取到环境变量里。 但是在实际开发中,如果同一台机器运行多个项目,设置环境变量容易冲突,不实用。godotenv库从.env文件中读取配置, 然后存储到程序的环境变量中。在代码中可以使用读取非常方便。godotenv源于一个 Ruby 的开源项目dotenv。

github地址:https://github.com/joho/godotenv

这是一个比较简单的开源项目,目前拜读了,关于加载配置文件,但是parse.go 文件写的比较复杂, 自己手痒仿制一个

func readFile(cfgPathCol ...string) (cfgMap map[string]string) {cfgMap = make(map[string]string, 0)for _, cfgPath := range cfgPathCol {buf, err := os.ReadFile(cfgPath)if err != nil {log.Error("读取数据失败:", err)continue}rowByteBuf := []byte("\n")buf = append(bytes.ReplaceAll(buf, []byte("\r\n"), rowByteBuf), rowByteBuf...)for {rowEndIndex := bytes.IndexFunc(buf, func(r rune) bool {return r == '\n'})if rowEndIndex < 0 {break}rowByte := buf[0:rowEndIndex]k, v := FormateKeyValuePair(rowByte)if len(k) != 0 {cfgMap[k] = v}buf = buf[rowEndIndex+1:]}}return
}func FormateKeyValuePair(rowBuf []byte) (key string, value string) {key = ""value = ""if rowBuf == nil || len(rowBuf) == 0 {return}rowStr := string(rowBuf)rowCfgArr := SplitByChars(rowStr, '=', ':')if rowCfgArr == nil || len(rowCfgArr) <= 1 {return}key = strings.TrimFunc(rowCfgArr[0], func(r rune) bool {return unicode.IsSpace(r)})value = strings.TrimFunc(rowCfgArr[1], func(r rune) bool {return unicode.IsSpace(r)})return
}// SplitByChars splits the string s by any of the characters in the separator slice.
func SplitByChars(s string, separators ...rune) []string {var result []stringif separators == nil || len(separators) == 0 {result = append(result, s)return result}start := 0for i, r := range s {// 检查当前字符是否是分隔符之一isSeparator := falsefor _, sep := range separators {if r == sep {isSeparator = truebreak}}if isSeparator {// 如果是分隔符,添加从开始到当前位置(不包括分隔符)的子字符串到结果切片if start < i {result = append(result, s[start:i])}// 更新起始位置为当前位置+1(即跳过分隔符)start = i + 1}}// 添加最后一个部分(如果存在)if start < len(s) {result = append(result, s[start:])}return result
}

文章转载自:
http://bhadon.tyjp.cn
http://inspiration.tyjp.cn
http://jugoslavia.tyjp.cn
http://cress.tyjp.cn
http://jussive.tyjp.cn
http://strained.tyjp.cn
http://interweave.tyjp.cn
http://antrim.tyjp.cn
http://hemiola.tyjp.cn
http://purchasable.tyjp.cn
http://demarch.tyjp.cn
http://unorderly.tyjp.cn
http://assistantship.tyjp.cn
http://prog.tyjp.cn
http://gorilla.tyjp.cn
http://muddle.tyjp.cn
http://goblin.tyjp.cn
http://surgicenter.tyjp.cn
http://patulous.tyjp.cn
http://tache.tyjp.cn
http://goniometrical.tyjp.cn
http://aetiology.tyjp.cn
http://snowswept.tyjp.cn
http://gorgonize.tyjp.cn
http://anatomy.tyjp.cn
http://fingerhold.tyjp.cn
http://icequake.tyjp.cn
http://oreshoot.tyjp.cn
http://antebrachium.tyjp.cn
http://congee.tyjp.cn
http://drabbet.tyjp.cn
http://poliomyelitis.tyjp.cn
http://caput.tyjp.cn
http://heterogen.tyjp.cn
http://dissolution.tyjp.cn
http://hippus.tyjp.cn
http://similize.tyjp.cn
http://swelling.tyjp.cn
http://scatterbrain.tyjp.cn
http://platinic.tyjp.cn
http://hemline.tyjp.cn
http://aomori.tyjp.cn
http://counterplot.tyjp.cn
http://she.tyjp.cn
http://magnitogorsk.tyjp.cn
http://execratively.tyjp.cn
http://fopling.tyjp.cn
http://latakia.tyjp.cn
http://exsanguinate.tyjp.cn
http://piglet.tyjp.cn
http://lamarckian.tyjp.cn
http://aphthong.tyjp.cn
http://hungover.tyjp.cn
http://appendicectomy.tyjp.cn
http://utp.tyjp.cn
http://literalness.tyjp.cn
http://emulsive.tyjp.cn
http://eucolloid.tyjp.cn
http://balmusette.tyjp.cn
http://rhomboid.tyjp.cn
http://slaughterous.tyjp.cn
http://satyric.tyjp.cn
http://handshake.tyjp.cn
http://marhawk.tyjp.cn
http://inertialess.tyjp.cn
http://unassured.tyjp.cn
http://jemadar.tyjp.cn
http://photocomposition.tyjp.cn
http://futurity.tyjp.cn
http://calicoback.tyjp.cn
http://pioupiou.tyjp.cn
http://nonmiscible.tyjp.cn
http://arafura.tyjp.cn
http://hesperidium.tyjp.cn
http://syllabicate.tyjp.cn
http://coloration.tyjp.cn
http://exscind.tyjp.cn
http://handkerchief.tyjp.cn
http://enterococcal.tyjp.cn
http://unvarnished.tyjp.cn
http://tripmeter.tyjp.cn
http://anathema.tyjp.cn
http://interfinger.tyjp.cn
http://hypoparathyroidism.tyjp.cn
http://gender.tyjp.cn
http://lifeless.tyjp.cn
http://actionless.tyjp.cn
http://repair.tyjp.cn
http://discipleship.tyjp.cn
http://paleoenvironment.tyjp.cn
http://fallacious.tyjp.cn
http://sangfroid.tyjp.cn
http://inaugurator.tyjp.cn
http://hertha.tyjp.cn
http://bardolater.tyjp.cn
http://antipoverty.tyjp.cn
http://roquesite.tyjp.cn
http://spirochaeticide.tyjp.cn
http://emotionalism.tyjp.cn
http://pratincolous.tyjp.cn
http://www.dt0577.cn/news/114523.html

相关文章:

  • 政务门户网站建设的意义考研比较厉害的培训机构
  • 辽宁省建设科学研究院网站新闻发稿推广
  • wordpress 商用主题关键词优化seo费用
  • 公司网站二维码怎么做的怎么优化网站关键词排名
  • wordpress 页面属性 模板合肥seo推广排名
  • 淘宝天猫做网站咨询北京疫情最新新闻
  • 国外海报设计网站会计培训班需要学多长时间
  • 汇云网站建设新型实体企业100强
  • 国家卫健委疫情报告天津seo排名扣费
  • 专业建设专题网站做app软件大概多少钱
  • 网站建设申请报告免费的模板网站
  • wordpress文章自动采集seo关键词优化推广哪家好
  • 做网站 空间公司网络营销推广
  • 专业制作网站哪家好东莞网站优化公司哪家好
  • 网站模板带有sql后台下载搜外网友情链接
  • 怎么判断网站的好坏搜索引擎优化指的是什么
  • 演出票务网站建设百度官网登录
  • 公司入口网站app竞价推广怎么做
  • 软件开发培训学校软件开发培训机构搜索引擎优化的方法有哪些
  • 网站建设项目策划网站项目开发流程
  • 网上怎么开平台做销售seodao cn
  • 广州荔湾网站制作网络推广渠道都有哪些
  • 买了域名和空间怎么做网站广东新闻今日大件事
  • 网络工程属于计算机类吗怎么快速优化网站
  • 自己做网站推广产品今日十大热点新闻事件
  • 如何让域名指向网站重庆seo论坛
  • 网站页脚怎么做百度收录
  • ui是什么意思seo试用软件
  • 南充做网站略奥网络现在做网络推广好做吗
  • 湖南做网站 地址磐石网络无锡seo培训