简体   繁体   English

在Rails的Webrick服务器中设置环境变量

[英]Set Environment Variables in Rails' Webrick Server

we're using some Company-wide Auth-Module ( entrust getaccess) which basically leaves some environment variables after authentication (gid, username, etc...). 我们使用的是整个公司范围内的Auth-Module(委托getaccess),它基本上在身份验证后留下了一些环境变量(gid,用户名等)。

To fake this auth for testing purposes I'd set the following env varibales in apache: 要出于测试目的伪造此身份验证,我将在Apache中设置以下环境变量:

        SetEnv "AUTH_TYPE" "Entrust-GetAccess"
        SetEnv "HTTP_SCTCGID" "johndoe"

Is this somehow possible with the WebRICK Server, too? WebRICK Server也可以通过某种方式实现吗?

best regards, Björn 最好的问候,比约恩

In your development.rb file: 在您的development.rb文件中:

ENV['AUTH_TYPE'] = "Entrust-GetAccess"
ENV['HTTP_SCTCGID'] = "johndoe"

If you need this on other environments, put it on the respective staging.rb or production.rb, or just on application.rb to set them on all environments. 如果在其他环境上需要此功能,请将其放在相应的staging.rb或production.rb上,或仅放在application.rb上以在所有环境上进行设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM