【问题标题】:Rebar shell - passing config file钢筋外壳 - 传递配置文件
【发布时间】:2015-04-06 16:30:11
【问题描述】:

我相信这会很简单,我会问自己,但是我如何在调用rebar shell 时将 erl args,如 -config {file} 传递给 erl?我认为它会简单地通过任何与它自己的开关不匹配的东西,但不是这样。

【问题讨论】:

    标签: erlang rebar


    【解决方案1】:

    rebar shell 似乎不允许参数,但它基本上等同于以下命令行:

    erl -pa deps/*/ebin -pa ebin
    

    如果您的项目没有依赖项,则不需要 -pa deps/*/ebin 部分。 如果您需要额外的参数,只需将它们添加到此命令中即可。

    另一种选择是使用ERL_FLAGS 环境变量来指定额外的参数:

    ERL_FLAGS='-config my_config_file.config' rebar shell
    

    【讨论】:

      【解决方案2】:

      每次你的 rebar.config 修改都不是优雅的,但你可以使用元组 {sys_config, FilePath}。

      {sys_config, "config/sys.config"}.
      

      当你运行命令“rebar3 shell”时,它们会加载放置在“config/sys.config”中的配置

      【讨论】:

        【解决方案3】:

        rebar3 现在直接支持这个:

        • rebar3 shell --config something.config,或
        • {shell, [{config, "something.config}]}. 添加到您的rebar.config

        【讨论】:

          猜你喜欢
          • 2012-11-16
          • 2011-07-27
          • 2014-12-17
          • 2016-08-05
          • 2016-08-28
          • 2012-06-26
          • 2013-09-16
          • 2013-07-27
          • 2012-10-15
          相关资源
          最近更新 更多