如何设置nova-api的os.environ?

时间:2021-11-18 22:44:14

I want to set the some variable in nova-api.

我想在nova-api中设置一些变量。

Which is the best way to set that? (in nova.conf or in other file?)

设置它的最佳方法是哪种? (在nova.conf或其他文件中?)

I can set in /etc/nova/nova.conf and get the value of that variable in the api. But is there any other way to set environment variable for the API? I want to access by os.environ in the script. (Is this the right way to access or not?)

我可以在/etc/nova/nova.conf中设置并在api中获取该变量的值。但是有没有其他方法为API设置环境变量?我想通过脚本中的os.environ访问。 (这是正确的访问方式吗?)

As per my knowledge, for the wsgi we have to set in the apache's config file. But for nova I cant find the file :(.

据我所知,对于wsgi,我们必须在apache的配置文件中设置。但对于新星我找不到文件:(。

Thanks in advance for the help.

先谢谢您的帮助。

1 个解决方案

#1


1  

Set the env variable from the init.d script. In the scrip /etc/init.d/openstack-nova-api one file is used /etc/sysconfig/$prog so we set the export variable in this file and got the reference later.

从init.d脚本设置env变量。在脚本/etc/init.d/openstack-nova-api中,一个文件使用/ etc / sysconfig / $ prog,所以我们在这个文件中设置导出变量,稍后得到引用。

#1


1  

Set the env variable from the init.d script. In the scrip /etc/init.d/openstack-nova-api one file is used /etc/sysconfig/$prog so we set the export variable in this file and got the reference later.

从init.d脚本设置env变量。在脚本/etc/init.d/openstack-nova-api中,一个文件使用/ etc / sysconfig / $ prog,所以我们在这个文件中设置导出变量,稍后得到引用。