Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自定义 server.properties 文件存储位置 #2734

Closed
dongzl opened this issue Nov 5, 2019 · 5 comments
Closed

自定义 server.properties 文件存储位置 #2734

dongzl opened this issue Nov 5, 2019 · 5 comments
Labels

Comments

@dongzl
Copy link

dongzl commented Nov 5, 2019

Apollo 团队你们好:

请教一个使用中的问题,对于server.properties文件,我看是固定存储目录结构:

/opt/settings/server.properties
C:\opt\settings\server.properties

两个问题:
1、这个目录的位置可以自定义吗?我想直接放到项目工程中使用,因为公司要求不能随便往服务器上传文件;
2、如果不可以自定义文件位置,目前这种固定位置设计的初衷是什么?

谢谢^_^

@nobodyiam
Copy link
Member

1、这个目录的位置可以自定义吗?我想直接放到项目工程中使用,因为公司要求不能随便往服务器上传文件;

目前不支持自定义

2、如果不可以自定义文件位置,目前这种固定位置设计的初衷是什么?

server.properties中存放的是环境信息,我们的设计是环境信息应该和程序隔离,所以不希望env等信息可以从代码中的配置文件获取。如果实在有这样的需求,那么可以通过-D参数或系统环境变量来满足,这个目前不管是env属性还是idc属性都是支持的。

至于server.properties本身,在一家公司中应该都是固定位置的,也就是不会出现一家公司中的不同应用配置不同的地址。

所以这里额外的问题其实就在于是否所有公司都可以遵循这个规范, 把环境信息放在/opt/settings/server.propertiesC:\opt\settings\server.properties。目前来看还没有来自这块的反馈,如果需要自定义的话,一种方式是再增加一个配置项来配置这个文件的地址(使用起来有负担),一种方式是可以自定义ServerProvider。

@dongzl
Copy link
Author

dongzl commented Nov 8, 2019

收到,非常感谢您的解答。

环境信息应该和程序隔离 这个设计我认为是好的,但是还是希望可以自定义这个目录位置,对于我们公司服务器只有固定目录结构是可以直接访问的,其他目录结构操作(新增文件 & 修改文件内容)需要专门的运维人员才可以。

建议可以再收集一些用户反馈,是不是会有同样的需求,再决定是否添加配置项,谢谢!

@nobodyiam
Copy link
Member

是的,我们之前的设计考虑是server.properties属于机器出厂信息,该文件应该是运维人员初始化环境的时候产生,程序只能读取,不能去修改或创建。

@dongzl
Copy link
Author

dongzl commented Nov 10, 2019

收到,明白设计的初衷了,感谢您的解答~

@stale
Copy link

stale bot commented Jan 9, 2020

This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in 14 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants