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

Thumbnail feature SHOULD be optional (module chooser) + configuration of the thumbnail URL #598

Open
vttranlina opened this issue Mar 13, 2023 · 0 comments
Labels

Comments

@vttranlina
Copy link
Member

How

  • DISABLE by default
  • The configuration will be provided in thumbnail.properties
    • enable: true|false
    • url: Optional. Require when enable is true
  • Use Guice Module to install instance dependencies
  • Configuration class: ThumbnailModuleChooserConfiguration.java
public record ThumbnailModuleChooserConfiguration(boolean enable, Optional<URL> url) {
    public static ThumbnailModuleChooserConfiguration parse(PropertiesProvider propertiesProvider) throws ConfigurationException {
        try {
            Configuration configuration = propertiesProvider.getConfiguration("thumbnail");
            boolean enable = configuration.getBoolean("enable", false);
            Optional<URL> urlOptional = Optional.ofNullable(configuration.getString("url", null))
                .map(Throwing.function(URL::new));
            if (enable) {
                Preconditions.checkArgument(urlOptional.isPresent(), "url is required");
            }
            return new ThumbnailModuleChooserConfiguration(enable, urlOptional);
        } catch (FileNotFoundException e) {
            return new ThumbnailModuleChooserConfiguration(false, Optional.empty());
        }
    }
}

Dod

  • Integration test, the thumbnail capability should be advertising in the session route when enabled
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

1 participant