actionml / harness

Harness is a Machine Learning/AI Server with plugins for many algorithms including the Universal Recommender
Apache License 2.0
283 stars 49 forks source link

ElasticSearch Authentication not available through environment variables #275

Closed joetex closed 3 years ago

joetex commented 4 years ago

Hello,

Looking at the source code in ElasticSearchSupport.scala: https://github.com/actionml/harness/blob/42d660c49332c88d7681e4c296ea1967e067ab2e/rest-server/core/src/main/scala/com/actionml/core/search/elasticsearch/ElasticSearchSupport.scala#L594

      if (config.hasPath("elasticsearch.auth")) {
        val authConfig = config.getConfig("elasticsearch.auth")
        builder.setHttpClientConfigCallback(new BasicAuthProvider(
          authConfig.getString("username"),
          authConfig.getString("password")
        ))
      }

This only allows Elastic Search authentication through application.conf. Could this be changed to use Properties.envOrElse, so that it will work on the Docker Compose setup?

I would suggest the names that match elasticsearch container: ELASTIC_USERNAME ELASTIC_PASSWORD

Thanks,

Joel

sbohner14335 commented 3 years ago

Hello, we are having the same issue where we need authentication.

Could we please have this implemented?

qqmbr4k commented 3 years ago

This only allows Elastic Search authentication through application.conf. you also can set|override application.conf with command line params. It depends on how you run harness, but this https://groups.google.com/g/scala-user/c/4lpS1KX9Zx0 discussion may be helpful