2

Currently I have a Storage Extension for SDL Web 8.5 (I extended from 'JPABinaryContentDAO' and implemented 'BinaryContentDAO'). I have some settings hard-coded in the Java code, which are environment specific.

What is the best-practice to store and retrieve values from config files in this case?

The constructors do not contain any reference to the configuration.

4

Found my answer on: http://www.tridiondeveloper.com/using-a-configuration-file-for-your-custom-tridion-content-delivery-code.

public MyStorageExtension(String storageId, EntityManagerFactory entityManagerFactory, EntityManager entityManager, String storageName) throws ConfigurationException
{
    super(storageId, entityManagerFactory, entityManager, storageName);
    configuration = new XMLConfigurationReader().readConfiguration("settings.xml"); //create this file in the config directory of the deployer
    String s = ConfigurationHelper.getStringValue(configuration, "/appSettings/endpoint", "DEFAULT FALLBACK STRING VALUE");

}

That's all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.