Skip to content

Instantly share code, notes, and snippets.

@jessuppi
Last active August 6, 2020 18:47
Show Gist options
  • Save jessuppi/53880a878b4615e4353a60adf7d58ca9 to your computer and use it in GitHub Desktop.
Save jessuppi/53880a878b4615e4353a60adf7d58ca9 to your computer and use it in GitHub Desktop.

Revisions

  1. jessuppi revised this gist Aug 6, 2020. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -13,3 +13,15 @@
    # sed "s#src='https://$SITE_DOMAIN#src='https://$SITE_DOMAIN/staging#g" /tmp/staging.sql
    # sed "s#src='http://$SITE_DOMAIN#src='https://$SITE_DOMAIN/staging#g" /tmp/staging.sql
    # sed "s#src='//$SITE_DOMAIN#src='https://$SITE_DOMAIN/staging#g" /tmp/staging.sql

    ## copy salt keys from production to staging (enables permanent login on both production/staging) ##
    # sed "/'AUTH_KEY'/c\\$PROD_AUTH_KEY" /var/www/html/staging/wp-config.php
    # sed "/'SECURE_AUTH_KEY'/c\\$PROD_SECURE_AUTH_KEY" /var/www/html/staging/wp-config.php
    # sed "/'LOGGED_IN_KEY'/c\\$PROD_LOGGED_IN_KEY" /var/www/html/staging/wp-config.php
    # sed "/'NONCE_KEY'/c\\$PROD_NONCE_KEY" /var/www/html/staging/wp-config.php
    # sed "/'AUTH_SALT'/c\\$PROD_AUTH_SALT" /var/www/html/staging/wp-config.php
    # sed "/'SECURE_AUTH_SALT'/c\\$PROD_SECURE_AUTH_SALT" /var/www/html/staging/wp-config.php
    # sed "/'LOGGED_IN_SALT'/c\\$PROD_LOGGED_IN_SALT" /var/www/html/staging/wp-config.php
    # sed "/'NONCE_SALT'/c\\$PROD_NONCE_SALT" /var/www/html/staging/wp-config.php

    # sed -n "#NONCE_SALT#c $PROD_NONCE_SALT#p" /var/www/html/staging/wp-config.php
  2. jessuppi created this gist Aug 6, 2020.
    15 changes: 15 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    ## fix hyperlinks (but not media src as they are shared with production uploads folder) ##
    # sed 's#href="https://$SITE_DOMAIN#href="https://$SITE_DOMAIN/staging#g' /tmp/staging.sql
    # sed 's#href="http://$SITE_DOMAIN#href="https://$SITE_DOMAIN/staging#g' /tmp/staging.sql
    # sed 's#href="//$SITE_DOMAIN#href="https://$SITE_DOMAIN/staging#g' /tmp/staging.sql
    # sed "s#href='https://$SITE_DOMAIN#href='https://$SITE_DOMAIN/staging#g" /tmp/staging.sql
    # sed "s#href='http://$SITE_DOMAIN#href='https://$SITE_DOMAIN/staging#g" /tmp/staging.sql
    # sed "s#href='//$SITE_DOMAIN#href='https://$SITE_DOMAIN/staging#g" /tmp/staging.sql

    ## fix sources (mirrors to production uploads folder using Nginx alias so this is just for cleaner source code) ##
    # sed 's#src="https://$SITE_DOMAIN#src="https://$SITE_DOMAIN/staging#g' /tmp/staging.sql
    # sed 's#src="http://$SITE_DOMAIN#src="https://$SITE_DOMAIN/staging#g' /tmp/staging.sql
    # sed 's#src="//$SITE_DOMAIN#src="https://$SITE_DOMAIN/staging#g' /tmp/staging.sql
    # sed "s#src='https://$SITE_DOMAIN#src='https://$SITE_DOMAIN/staging#g" /tmp/staging.sql
    # sed "s#src='http://$SITE_DOMAIN#src='https://$SITE_DOMAIN/staging#g" /tmp/staging.sql
    # sed "s#src='//$SITE_DOMAIN#src='https://$SITE_DOMAIN/staging#g" /tmp/staging.sql