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

feat: support template plugin path #2642

Open
wants to merge 12 commits into
base: development
Choose a base branch
from

Conversation

moreal
Copy link
Contributor

@moreal moreal commented Nov 25, 2024

Previously, we need to manage several configuration files for each os and architecture. (e.g., linux-amd64, linux-arm64, etc) because pluginPath field is a constant string.

This pull request introduces a new feature for pluginPath field in appsettings.json-like configuration files.

To use this feature, you must specify version field to 2 first.

{
	"actionEvaluator": {
        "version": 2,
        "type": "PluggedActionEvaluator",
        "pluginPath": "https://lib9c-plugin.s3.us-east-2.amazonaws.com/51c8b73fb5df5cb1e3e3db2d5a8b094dbe5e7ae1/linux-arm64.zip"
    }
}

The actionEvaluator with version: 2 and type: PluggedActionEvaluator, uses pluginPath as template.

The decoder of actionEvaluator replaces the following keywords in pluginPath, with corresponding values.

  • <os>: Operating Systems. (macOSosx, Windowswin, Linuxlinux, not supported else) (It is determined by .NET RuntimeInformation.IsOSPlatform(...)).
  • <arch>: OS Architecture. (x64x64, x86x86, Arm64arm64, Armarm, not supported else) (It is determined by .NET RuntimeInformation.OSArchitecture).
  • <rid>: Same with <os>-<arch> (e.g., linux-arm64) (https://learn.microsoft.com/en-us/dotnet/core/rid-catalog#known-rids)
{
	"actionEvaluator": {
        "version": 2,
        "type": "PluggedActionEvaluator",
        "pluginPath": "https://lib9c-plugin.s3.us-east-2.amazonaws.com/51c8b73fb5df5cb1e3e3db2d5a8b094dbe5e7ae1/<os>-<arch>.zip"
    }
}

Or

{
	"actionEvaluator": {
        "version": 2,
        "type": "PluggedActionEvaluator",
        "pluginPath": "https://lib9c-plugin.s3.us-east-2.amazonaws.com/51c8b73fb5df5cb1e3e3db2d5a8b094dbe5e7ae1/<rid>.zip"
    }
}

@moreal moreal self-assigned this Nov 25, 2024
@auto-assign auto-assign bot requested review from area363 and ipdae November 25, 2024 07:12
@moreal moreal marked this pull request as draft November 25, 2024 07:22
@moreal moreal marked this pull request as ready for review November 25, 2024 09:06
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

Successfully merging this pull request may close these issues.

1 participant