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

ArkContainer 支持读取自定义配置 #1021

Open
gaosaroma opened this issue Nov 1, 2024 · 1 comment
Open

ArkContainer 支持读取自定义配置 #1021

gaosaroma opened this issue Nov 1, 2024 · 1 comment

Comments

@gaosaroma
Copy link
Collaborator

gaosaroma commented Nov 1, 2024

Feature description

现状

在 SOFA-ARK 2.0+ 中,基座启动 ArkContainer 时,将通过 ContainerClassLoader 读取自定义配置。但 ContainerClassLoader 的 ucp 仅有 sofa-ark-all 及其依赖,从而无法读取用户自定义配置,见:

  • Ark 配置读取
    com.alipay.sofa.ark.container.ArkContainer#getProfileConfFiles
    image

  • ContainerClassLoader 初始化
    com.alipay.sofa.ark.bootstrap.AbstractLauncher#createContainerClassLoader(com.alipay.sofa.ark.spi.archive.ContainerArchive)
    image

需求

支持读取用户基座中 conf/ark/bootstrap.properties 作为自定义配置。

Additional notes

Add other notes if necessary.

@gaosaroma
Copy link
Collaborator Author

在基座打包时,可以通过 maven-resources-plugin 把 conf 资源打包到 jar 包中,如:

<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<executions>
					<execution>
						<id>copy-resources</id>
						<!-- here the phase you need -->
						<phase>prepare-package</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${basedir}/target/classes/conf/ark</outputDirectory>
							<resources>
								<resource>
									<directory>${basedir}/conf/ark</directory>
									<filtering>true</filtering>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>

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

No branches or pull requests

1 participant