dae icon indicating copy to clipboard operation
dae copied to clipboard

[Feature Request] Support corn configuration

Open fbewivpjsbsby opened this issue 1 year ago • 6 comments

Greetings

No response

Feature Request

使用 corn 配置语言,corn 的灵感来自于 json 和 nix,和 dae 相似

Use Cases

目前,我们定义 outbound 时是这样使用的

group {
    example_group {
        # example policy
        policy: example_policy
    }
}

在 corn 中我们可以创建 Key chaining

// example policy
{ group.example_group.policy = "example_policy" }

以及我们可以在 let 中定义后再使用

let {
  $example_policy = "example_policy"
} in {
  group.example_group.policy = $example_policy
}

Potential Benefits

引用 corn 的介绍

Corn has been designed using inspiration from JSON and Nix to produce a language that's easy and intuitive to write, good for config files, and has a feature-set small enough you can learn it in minutes. It was born out of the following frustrations:

  • JSON is not a config language, despite how often people use it as one.
  • TOML is good for flat structures but gets ugly quickly with deeper objects.
  • YAML is far too complex and its whitespace rules make it error-prone.
  • Nix is a full-sized language and not easy to integrate.

corn 相比 dae 能够有更多功能,也不像 nix 一般引入过多依赖 相比 dae,corn 更加通用

fbewivpjsbsby avatar Sep 24 '23 02:09 fbewivpjsbsby

Thanks for opening this issue!

dae-prow[bot] avatar Sep 24 '23 02:09 dae-prow[bot]

@fbewivpjsbsby corn 本身很好,但我认为太过编程式的语言不太适合没有基础的用户

mzz2017 avatar Sep 24 '23 02:09 mzz2017

@mzz2017 +1

piyoki avatar Sep 24 '23 02:09 piyoki

If you need english version

Feature Request

Use corn configuration language, Corn has been designed using inspiration from JSON and Nix, like dae

Use Cases

Now, We define outbound

group {
    example_group {
        # example policy
        policy: example_policy
    }
}

We can ceate Key chaining in corn

// example policy
{ group.example_group.policy = "example_policy" }

And we can define it in let

let {
  $example_policy = "example_policy"
} in {
  group.example_group.policy = $example_policy
}

Potential Benefits

Corn introduction

Corn has been designed using inspiration from JSON and Nix to produce a language that's easy and intuitive to write, good for config files, and has a feature-set small enough you can learn it in minutes. It was born out of the following frustrations:

  • JSON is not a config language, despite how often people use it as one.
  • TOML is good for flat structures but gets ugly quickly with deeper objects.
  • YAML is far too complex and its whitespace rules make it error-prone.
  • Nix is a full-sized language and not easy to integrate.

Corn has more features than dae, and does not add too many dependencies like nix Compared to dae, corn is more universal

fbewivpjsbsby avatar Sep 24 '23 02:09 fbewivpjsbsby

@fbewivpjsbsby corn 本身很好,但我认为太过编程式的语言不太适合没有基础的用户

dae 目前在低嵌套还比较可读取,但比如 dns.routing.request 下就比较容易和 routing 搞错了 以及 node.chains 使用 RoutingA 格式虽然不错,但使用 link 时就会变成

node {
    chains: 'tuic://supersupersupersupersupersupersupersuperlongtuiclink' -> 'vmess://supersupersupersupersupersupersupersuperlongvmesslink' -> 'vmess://supersupersupersupersupersupersupersuperlongvmesslink'
}

更不可读

fbewivpjsbsby avatar Sep 24 '23 03:09 fbewivpjsbsby

@fbewivpjsbsby 或许两个分别有上手难度和可读性的问题,我们有其他选项吗

mzz2017 avatar Sep 24 '23 04:09 mzz2017