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

Simplify application configuration by using only properties where possible #3

Closed
peneksglazami opened this issue Oct 28, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@peneksglazami
Copy link
Contributor

At the moment, if we need to work with several tarantool instances at once, we have to configure and create service beans ourselves.

@Configuration
@PropertySource(value = "classpath:application-tarantool.properties", encoding = "UTF-8")
@EnableTarantoolRepositories(basePackageClasses = UserTarantoolRepository.class)
public class TarantoolConfiguration extends AbstractTarantoolDataConfiguration {

    @Value("${tarantool.nodes}")
    private String nodes;
    @Value("${tarantool.username}")
    private String username;
    @Value("${tarantool.password}")
    private String password;

    @Override
    @Bean("tarantoolClusterAddressProvider")
    public TarantoolClusterAddressProvider tarantoolClusterAddressProvider() {
        List<TarantoolServerAddress> addressList = new ArrayList<>();
        for (String address : nodes.split(",")) {
            String[] parts = address.split(":");
            String host = parts[0];
            int port = Integer.parseInt(parts[1]);
            addressList.add(new TarantoolServerAddress(host, port));
        }

        return () -> addressList;
    }

    @Override
    protected void configureClientConfig(TarantoolClientConfig.Builder builder) {
        builder.withCredentials(new SimpleTarantoolCredentials(username, password));
    }
}

I propose to add the ability to configure the application through a set of properties and assign the logic of their interpretation and application, for example, to AbstractTarantoolDataConfiguration.

For example, we can add support for properties such as

spring.data.tarantool.nodes=localhost:3301,172.1.0.2:3301,172.1.0.3:3303 (default - 127.0.0.1:3301)
spring.data.tarantool.username=admin (default - "guest")
spring.data.tarantool.password=passw0rd (default - "")
spring.data.tarantool.connection-selection-strategy=RoundRobinStrategy (default - "ParallelRoundRobinStrategy")
...
@akudiyar akudiyar added this to the 0.3.0 milestone Oct 29, 2020
@akudiyar akudiyar added the enhancement New feature or request label Oct 29, 2020
@akudiyar akudiyar modified the milestones: 0.3.0, Q42020 Nov 13, 2020
@akudiyar akudiyar added 0.5.0 and removed 0.4.0 labels Jan 29, 2021
@akudiyar akudiyar modified the milestones: Q4 2020, Q1 2021 Jan 29, 2021
@vrogach2020 vrogach2020 removed the 0.5.0 label Sep 14, 2021
@vrogach2020 vrogach2020 removed this from the Q1 2021 milestone Sep 14, 2021
@vrogach2020 vrogach2020 removed the 1sp label Dec 30, 2021
@vrogach2020
Copy link
Contributor

Probably this can be covered by added spring boot starter to the library

@dkasimovskiy dkasimovskiy closed this as not planned Won't fix, can't repro, duplicate, stale Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants