Apereo CAS 服务器从“/etc/cas/config”而不是“${PROJECT_DIR}/etc/cas/config”加载配置

问题描述 投票:0回答:1

所以我有一个正在尝试配置的Apereo CAS 项目

我发现,当使用

./gradlew clean run
的 gradle 运行我的 Apereo CAS WAR 覆盖时,CAS 找不到配置。它说此信息消息为空:

2023-10-11 07:53:51,912 INFO [org.apereo.cas.configuration.DefaultCasConfigurationPropertiesSourceLocator] - <Configuration directory [null] is not a directory or cannot be found at the specific path>

这是因为它试图从

/etc/cas/config
加载配置,这是非常不切实际的,因为我需要不断将项目外部的这些文件复制到此文件夹中才能运行我的程序,以便可以找到这些文件。这是确认的,因为如果我复制文件,就会找到配置:

2023-10-11 08:05:32,929 INFO [org.apereo.cas.configuration.DefaultCasConfigurationPropertiesSourceLocator] - <Configuration files found at [/etc/cas/config] are [[file [/etc/cas/config/application.properties]]] under profile(s) [[standalone]]>

我认为 CAS 应该尝试从“${PROJECT_DIR}/etc/cas/config”加载配置,而不是

/etc/cas/config
。我可以使用任何属性或配置来进行此更改吗?我猜这是因为可以将项目部署为 Docker,它实际上从
/etc/cas/config
加载配置。我也使用 Docker 来部署软件,所以我的要求是在使用 Docker(
/etc/cas/config
配置文件)时能够从
prod
加载,如果我正在开发,则能够从 '${PROJECT_DIR}/etc/cas/config' 加载(
dev
个人资料)。

我使用的CAS服务器版本为6.6.12

docker gradle cas apereo
1个回答
0
投票

这是默认配置模式,表明 CAS 不需要连接到外部配置服务器,并将以嵌入式独立模式运行。启用此选项后,CAS 默认情况下将尝试在预定义的目录和文件中查找设置和属性,否则会回退到通常使用

/etc/cas/config
作为配置目录。

请注意,默认情况下,所有 CAS 设置和配置均通过 CAS 服务器 Web 应用程序中嵌入的

application.properties
文件进行控制。还有一个嵌入式
application.yml
文件,如果您希望将配置发送到主 CAS Web 应用程序内而不依赖于外部化配置文件,则可以使用该文件覆盖所有默认值。如果您更喜欢属性而不是 yaml,那么
application-standalone.properties
也将覆盖
application.properties

# Describes a directory path where CAS configuration may be found.
cas.standalone.configuration-directory=

# Describes a file path where that contains the CAS properties in a single file.
cas.standalone.configuration-file=
© www.soinside.com 2019 - 2024. All rights reserved.