Skip to content

配置文件

YoyoFx edited this page Dec 9, 2020 · 3 revisions

main

configuration := abstractions.NewConfigurationBuilder().AddYamlFile("config").Build()
// 添加环境为Prod的配置文件 config_prod.yml 
YoyoGo.NewWebHostBuilder().
       UseConfiguration(configuration).
       Configure(func(app *YoyoGo.WebApplicationBuilder) {
		   app.UseStaticAssets()       //添加静态资源
		   app.UseEndpoints(registerEndpointRouterConfig)  //api 路由
       }).Build().Run()

config_prod.yml

application:
  name: demo_prod
  metadata: "prod Env"
  server:
    type: "fasthttp"
    address: ":8080"
    max_request_size: 2096157
    static:
      patten: "/"
      webroot: "./Static"