There are some apps for which the creation of database and setting up admin user is hard to implement by script.
What would be the best way to provide end user with the database credentials for the app?
Is mailing the database credentials a good option or asking the user to grep the details is safe and better option ?
I’m not sure to understand what to you’re asking about the database.
To create a database with an user for an application, you could use the helper ynh_mysql_setup_db.
If your problem is to configure your app to use this database, you have to looking for the way this app store the information after the user add this database. And store the informations about this database at the same place.
I am talking about after install , if the database need to be created through web browser for eg. https://github.com/YunoHost-Apps/sonerezh_ynh needs to grep database password.
If you need to enter the credential for the database through a web interface. It’s better to use curl to do it.
In any case, the password will be store somewhere after the installation.