atrujillofalcon / mjml-rest-client

Java library to convert MJML templates to HTML
Other
21 stars 6 forks source link

Allow defining your own Mjml API Server #148

Closed pauli2406 closed 4 years ago

pauli2406 commented 4 years ago

Hi,

I would love to use my own hosted mjml Api Server with this package. It is based on https://github.com/danihodovic/mjml-server and has no authentication.

Am I able to configure this package to work with serves like that?

Best regards Marcel

atrujillofalcon commented 4 years ago

Hi @pauli2406! It's an excellent idea. I'm going to make it base host and port configurable.

atrujillofalcon commented 4 years ago

Reviewing my source code I have realized that it is currently configurable, on every auth client builder, you can use changeEndpoint method:

mjmlAuth = MjmlAuthFactory.builder()
                .withMemoryCredentials()
                .mjmlCredentials(appID, secretKey)
                .changeEndpoint("http://localhost:15500")
                .build();

mjmlAuth = MjmlAuthFactory.builder()
                .withPropertiesCredential()
                .properties(properties)
                .mjmlKeyNames(appIDPropKey, secretKeyPropKey)
                .changeEndpoint("http://localhost:15500")
                .build();

mjmlAuth = MjmlAuthFactory.builder()
                    .withEnvironmentCredentials()
                    .mjmlKeyNames(ENV_APP_ID, ENV_SECRET_KEY)
                    .changeEndpoint("http://localhost:15500")
                    .build();
atrujillofalcon commented 3 years ago

@pauli2406 Has the solution worked for you?

pauli2406 commented 3 years ago

Hey, sorry for not coming back to you. This solution seems to work.

Unfortunately in my use case it did not really fit. But the problem was not the functionality of this library but my project and the way I wanted it to execute. Because of that I implemented the logic in my own way at the end. Still thanks for your fast support! 😀