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

mongodb connection string parameters not supported #5344

Closed
lastpeony opened this issue Jul 7, 2023 · 0 comments
Closed

mongodb connection string parameters not supported #5344

lastpeony opened this issue Jul 7, 2023 · 0 comments
Assignees

Comments

@lastpeony
Copy link
Contributor

lastpeony commented Jul 7, 2023

When the MongoDB host contains the "?" character, the execution of create_app.sh through the REST API becomes problematic. This is due to the fact that the code responsible for executing commands on AMS does not support special characters.

For example:
clusterdb.host=mongodb://root:password@mongodb:27017/?readPreference=secondaryPreferred

Possible solution:
Please review and make necessary modifications to the getProcess function in AdminApplication.java. It may be necessary to add a new regular expression (regex) check to verify if the special character "?" is present and allow it as a valid parameter in the MongoDB string.

Steps to reproduce:
1-) set clusterdb.host setting with a mongodb url which contains ? character.
2-) try to create a new application through rest api.
3-) due to ? command wont be executed on server thus app is not created.

Logs:
antmediaserver | 2023-07-05 12:24:55,535 [vert.x-worker-thread-20] org.red5.server.tomcat.WarDeployer - Deploy wars with app start
antmediaserver | 2023-07-05 12:24:57,684 [http-nio2-0.0.0.0-5080-exec-9] org.red5.server.adapter.MultiThreadedApplicationAdapter - Running create app script, war file name (null if default): null, app name: mynewtest
antmediaserver | 2023-07-05 12:24:57,685 [http-nio2-0.0.0.0-5080-exec-9] io.antmedia.console.AdminApplication - Creating application with command: /bin/bash create_app.sh -n mynewtest -w true -p /usr/local/antmedia -c true -m mongodb://root:password@mongodb:27017/?readPreference=secondaryPreferred -u -s
antmediaserver | 2023-07-05 12:24:57,685 [http-nio2-0.0.0.0-5080-exec-9] org.red5.server.adapter.MultiThreadedApplicationAdapter - Command includes special characters so it's refused to run. Failed argument:mongodb://root:pas
sword@mongodb:27017/?readPreference=secondary
Preferred and full command:/bin/bash create_app.sh -n mynewtest -w true -p /usr/local/antmedia -c true -m mongodb://root:password@mongodb:27017/?readPreference=secondaryPreferred -u -s
antmediaserver | 2023-07-05 12:24:57,686 [vert.x-worker-thread-19] org.red5.server.tomcat.WarDeployer - Deploy wars with app start

The API response is: {"success":false,"message":null,"dataId":null,"errorId":0}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants