[英]Custom command line options rails 3 Ruby
I am working on a website project that requires ruby 1.8.7 and using am currently rails 3.2. 我正在开发一个需要ruby 1.8.7的网站项目,并且当前使用的是Rails 3.2。 This is a research project and thus maybe a bit "unconventional".
这是一个研究项目,因此可能有点“非常规”。
I have a rails server, the manager, that spawns other rails servers which become peers in a P2P network. 我有一个Rails服务器,即管理器,它产生了其他的Rails服务器,这些服务器成为P2P网络中的对等服务器。
I want to pass custom options to my spawned servers to configure them. 我想将自定义选项传递给生成的服务器以对其进行配置。 I thought about doing something like this but it does not seem possible in rails.
我曾想过要做这样的事情,但在Rails中似乎是不可能的。 Does somebody have a suggestion of how to do something similar?
有人对如何做类似的事情有建议吗?
rails server --custom_option="CUSTOM_VALUE"
Will environment variables work? 环境变量会起作用吗?
CUSTOM_OPTION=CUSTOM_VALUE rails s
This should give you access to it: 这应该使您可以访问它:
`$CUSTOM_OPTION`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.