OpenSIPS / opensips-cli

OpenSIPS CLI tool - an interactive command line tool that can be used to control and monitor OpenSIPS servers.
GNU General Public License v3.0
85 stars 48 forks source link

'database create' can't be run silently #41

Closed samk-acw closed 4 years ago

samk-acw commented 4 years ago

I'm trying automate my opensips deployment, including using opensips-cli to setup the database. The documentation for the database module suggests it should be possible to do this silently by defining the database parameters in a config file (or in-line with '-o') but it seems like this is not the case - running 'database create' will always prompt for the database url and whether to create all/current tables.

cat /etc/opensips/db.conf
[default]
database_url=mysql://root:rootpw@localhost
database_name=opensips
database_modules=acc auth_db avpops clusterer drouting group load_balancer

opensips-cli -xd database create -f /etc/opensips/db.conf
DEBUG: using config file /etc/opensips/db.conf
DEBUG: Loaded module 'database'
DEBUG: Loaded module 'diagnose'
DEBUG: Loaded module 'instance'
DEBUG: fifo file /tmp/opensips_fifo does not exist!
DEBUG: Skipping module 'mi' - excluded on purpose
DEBUG: Loaded module 'tls'
DEBUG: Loaded module 'trace'
DEBUG: Skipping module 'trap' - excluded on purpose
DEBUG: Loaded module 'user'
DEBUG: running in non-interactive mode '['database', 'create']'
DEBUG: running command 'create' '[]'
DEBUG: db_name: 'opensips'
Please provide the URL of the SQL database:

Running on Debian 10 with latest release of opensip-cli

razvancrainea commented 4 years ago

@samk-acw can you also set template_url variable to the same value as database_url?

samk-acw commented 4 years ago

that works - template_url stops the url string prompt, however I'm still get prompted about which tables to configure, even though database_modules is set: Create [a]ll tables or just the [c]urrently configured ones? (Default value is a):