GMOD / docker-apollo

:whale: Apollo 2.X Docker Image
GNU General Public License v3.0
10 stars 12 forks source link

Load config from /apollo/custom-docker-config.groovy too #13

Closed abretaud closed 7 years ago

abretaud commented 7 years ago

Hi, Thinking about #12, I came up with this solution: a modification to the default Config.groovy (line 18) to allow loading additional config from /apollo/custom-docker-config.groovy if it's present This way I managed to enable the REMOTE_USER login by mounting a file at /apollo/custom-docker-config.groovy containing:

apollo {
    authentications = [
        ["name":"Remote User Authenticator",
         "className":"remoteUserAuthenticatorService",
         "active":true,
        ]
    ]
}

Not really intended to be merged as is (having a copy of Config.groovy in this repo feels wrong), but it could interest you @nathandunn @erasche

nathandunn commented 7 years ago

@abretaud I think a better solution would be to over-ride the apollo-config.groovy which is designed to customize anything you don't want from the default Config.groovy file.

I think that the best solution would be to have a custom-apollo-config.groovy file that is not source-controlled and gets copied instead of the apollo-config.groovy file, however, that sounds like a pain of a solution based on this: http://stackoverflow.com/questions/31528384/conditional-copy-add-in-dockerfile

abretaud commented 7 years ago

@abretaud I think a better solution would be to over-ride the apollo-config.groovy which is designed to customize anything you don't want from the default Config.groovy file.

Hum, but that's what it does, no? From reading the grails doc, the config files in grails.config.locations are supposed to be loaded one after the other, the last one overriding the previous ones.

(first time I play with a grails app, maybe I'm missing something)

I think that the best solution would be to have a custom-apollo-config.groovy file that is not source-controlled and gets copied instead of the apollo-config.groovy file, however, that sounds like a pain of a solution based on this: http://stackoverflow.com/questions/31528384/conditional-copy-add-in-dockerfile

Indeed, it looks like a pain :) And also the custom-apollo-config.groovy would need to be included in the war file, so you would need to rebuild the image everytime you change its content

nathandunn commented 7 years ago

Hum, but that's what it does, no? From reading the grails doc, the config files in grails.config.locations are supposed to be loaded one after the other, the last one overriding the previous ones.

This is correct. I guess what I was saying was that it looked like your configuration was customizing the Config.groovy file. However, this is going to change (hopefully not too much) with different versions of Apollo and is generally considered part of the release.

However, the apollo-config.groovy is designed to be read last and over-rides everything in the Config.groovy file, so that would be the better place to do the over-ride as convention.

Anyway, your solution does work.

abretaud commented 7 years ago

Ah ok, I see what you mean, thanks for the clarification! I think for now I'll just go with my own branch for this image, so no rush on this

nathandunn commented 7 years ago

Let me know if this should remain open.