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

update entrypoint to find auth property configs #15

Merged
merged 5 commits into from
Nov 30, 2023

Conversation

fordmcdonald
Copy link
Member

@fordmcdonald fordmcdonald commented Nov 28, 2023

Update Docker Entrypoint to Find Authentication Configs

In the entrypoint script, the following line local auth_configs=(/data/xnat/home/config/auth/!(ldap-provider.properties.example)) was yielding an error when no authentication property files were provided.

Rather than an empty list, auth_configs was assigned the literal pattern string /data/xnat/home/config/auth/!(ldap-provider.properties.example. Instead, we can use the find command to detect auth provider property files:

local auth_configs=($(find /data/xnat/home/config/auth/ -type f -not -name 'ldap-provider.properties.example'))

This results in the correct behavior if a valid config file is present or absent.

hollandjg
hollandjg previously approved these changes Nov 29, 2023
Copy link

@hollandjg hollandjg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Ford, it looks like you're filtering out a single file from the directory, and keeping everything else. Is there a good way to switch it around and positively select only the files you're interested in? That might be more robust if you need to add new files to the directory in future - otherwise you'll have to update this script again, and there's a chance that you'll forget and get weird errors which have nothing to do with the thing you're changing.

Is the list of files you want to include very long? It might be simplest just to list them explicitly if there are only a few.

Copy link

@hollandjg hollandjg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate comment deleted

@hollandjg hollandjg dismissed their stale review November 29, 2023 14:18

Wrong button

@mirestrepo
Copy link
Contributor

Hey Ford, it looks like you're filtering out a single file from the directory, and keeping everything else. Is there a good way to switch it around and positively select only the files you're interested in? That might be more robust if you need to add new files to the directory in future - otherwise you'll have to update this script again, and there's a chance that you'll forget and get weird errors which have nothing to do with the thing you're changing.

Is the list of files you want to include very long? It might be simplest just to list them explicitly if there are only a few.

I chatted with @fordmcdonald and I'm not sure if we should rely only on file patterns for inclusion. And user could potentially put valid/invalid files with whatever name. So maybe, read all the files and quit/error if the parsing doesn't work? or have every valid file follow .properties convention and document the expectations?

@broarr
Copy link
Contributor

broarr commented Nov 29, 2023

The original intent with the file inclusion stuff was to allow users to specify config files, with names that make sense to them, and have all those configs included in the main config. IIRC (which I probably don't) XNAT loads in all .properties files by default. Again, I'm probably wrong about that last bit, but it's worth checking!

Copy link
Contributor

@broarr broarr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it'll work right to me. Do you need spaces between the ( $(?

I'm not approving because it seems like there's more to talk about

@fordmcdonald
Copy link
Member Author

fordmcdonald commented Nov 29, 2023

@hollandjg I agree with you. I think we should be selecting only configuration files with .properties. In our case, I believe the only config file we should be matching is "brownldap-provider.properties". Otherwise, XNAT will default to "localdb" as the provider.

@mirestrepo Do you remember the reason why we're copying the example config into the auth directory in the first place? I feel like it's not serving a purpose, other than providing a template. But the template can still exist in the repository as reference.

@broarr I don't believe I need spaces there. From my testing, it seemed to work without them.

XNAT Auth Configuration Docs: https://wiki.xnat.org/documentation/configuring-authentication-providers

@mirestrepo
Copy link
Contributor

@hollandjg I agree with you. I think we should be selecting only configuration files with .properties. In our case, I believe the only config file we should be matching is "brownldap-provider.properties". Otherwise, XNAT will default to "localdb" as the provider.

@mirestrepo Do you remember the reason why we're copying the example config into the auth directory in the first place? I feel like it's not serving a purpose, other than providing a template. But the template can still exist in the repository as reference.

@broarr I don't believe I need spaces there. From my testing, it seemed to work without them.

XNAT Auth Configuration Docs: https://wiki.xnat.org/documentation/configuring-authentication-providers

That absolutely makes sense. Let's not copy the example file in the docker and only look for .properties files as specified in the docs. Maybe somewhere in the readme of this repo we should explain these things a little

@fordmcdonald
Copy link
Member Author

Ready for approval.

@mirestrepo @hollandjg @broarr

README.md Show resolved Hide resolved
docker-entrypoint.sh Outdated Show resolved Hide resolved
@fordmcdonald fordmcdonald merged commit 40db8ca into main Nov 30, 2023
1 check passed
@fordmcdonald fordmcdonald deleted the fix-auth-config-entrypoint branch November 30, 2023 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants