kore 配置简单说明

kore 官方提供对于配置的说明比较少(只包含了一些核心的,其他的没有详细说明)但是提供了一个参考示例

一些配置

实际建议还是通过结合代码阅读比较方便,config.c 中关于配置有比较完整的说明,同时也会发现一些官方暂时没介绍的

  • http_server_version 配置
    这个是配置server response 中server 信息的,可以自定义,覆盖官方默认的
  • 网络相关的
    包含的比较多,比较类似nginx,比如worker_max_connections ,workers,worker_set_affinity,http_body_timeout,http_request_limit
  • http 请求路由配置的
    比较类似nginx http 的location
 
domain localhost {
    attach        tls  ## 使用的监听,可以是http 以及https 的
 
    certfile    cert/server.crt
    certkey        cert/server.key
    accesslog    /var/log/kore_access.log
 
    route / {
        handler index_page  // 路由请求,包含了method 以及handler ,以及validate 方便参数校验
        methods get
    }
 
    route /login {
        handler login_do
        methods post
        validate post username v_username
        validate post passphrase v_passphrase
    }
}
  • include 支持
    这个在代码中有体现,但是文档 暂时没说,是一个很不错的功能,可以实现类似nginx include 的能力
    参考使用
 
hello.conf
 
server no_tls {
    bind 0.0.0.0 8888
    tls no
}
 
include conf/mydemo.conf
 
http_server_version dalongdemo
 
conf/mydemo.conf
 
load ./hello.so
domain * {
    attach        no_tls
    #certfile    cert/server.pem
    #certkey        cert/key.pem
    accesslog    access.log
    route / {
        handler page
        methods GET
    }
}

说明

kore 的配置设计上比较灵活,支持的玩法比较类似nginx,用好include 很方便,可以实现模块动态化加载

参考资料

https://docs.kore.io/4.2.0/applications/koreconf.html
https://github.com/jorisvink/kore/blob/master/src/kore.c#L271
https://github.com/jorisvink/kore/blob/master/src/config.c
https://github.com/jorisvink/kore/blob/master/src/http.c#L191
https://github.com/jorisvink/kore/blob/master/src/config.c#L307C1-L307C18
https://github.com/jorisvink/kore/blob/master/conf/kore.conf.example

posted on   荣锋亮  阅读(44)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2022-11-29 lavinmq cloudamqp 开源的amqp server
2022-11-29 一些不错的开源内网穿透工具
2022-11-29 一个历史k8s维护碰到的一些网络问题说明
2020-11-29 healthcheck一个不错的 Kubernetes liveness && readiness prob handler 实现
2020-11-29 proxysql proxy 集成golang-mysqlserver
2020-11-29 vernemq 典型的部署模型
2019-11-29 streamsets 官方默认镜像中文支持问题

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示