Reading of phing files



  • Hello! Just started studying and applying phing♪ For example, automate project deployment yii2-app-advanced On the horse. The establishment of a local domain, a project, the identification of relationships, the creation of an environment, a database has been automated. Next, user migration RBACbut before that, we need to add the configuration - at least the databases. And it's likely there's gonna be a few more excuses get into the scruples of the project with a machine. Are there special boards for such purposes and, in general, what are the practical recommendations for such tasks?



  • I don't know if this is relevant to you, but: The database is built with this tac:

    <target name="database" description="Configure database">
        <echo>Configure database connect</echo>
        <input propertyname="hostname" defaultValue="127.0.0.1"
               promptChar="?">Enter hostname of db:</input>
        <input propertyname="database" defaultValue=""
               promptChar="?">Enter name of db:</input>
        <input propertyname="username" defaultValue=""
               promptChar="?">Enter username to access db:</input>
        <input propertyname="password" defaultValue=""
               promptChar="?">Enter password to access db:</input>
        <input propertyname="prefix" defaultValue=""
               promptChar="?">Enter table prefix:</input>
        <copy file="config/db.php.dist"
              tofile="config/db.php" overwrite="true">
            <filterchain>
                <replacetokens begintoken="[[" endtoken="]]">
                    <token key="hostname" value="${hostname}" />
                    <token key="database" value="${database}" />
                    <token key="username" value="${username}" />
                    <token key="password" value="${password}" />
                    <token key="prefix" value="${prefix}" />
                </replacetokens>
            </filterchain>
        </copy>
    </target>
    

    The file of the database configuration is as follows:

    <?php
        return [
            'class'         => 'yii\db\Connection',
            'dsn'           => 'mysql:host=[[hostname]];dbname=[[database]]',
            'username'      => '[[username]]',
            'password'      => '[[password]]',
            'charset'       => 'utf8',
            'tablePrefix'   => '[[prefix]]'
       ];
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2