Using the Configuration Module Filter in Drush 8

Having a Dev/Test/Live workflow is indispensable to safe and convenient website development. If your workflow involves frequently refreshing your development database with the latest information available on the live site, then you may find that you must keep enabling the modules used only in the development site on every iteration. Various solutions exist in Drupal 7 to automate this process; for example, the drush sync-enable example file allows you to list modules in your site alias file that should be automatically enabled every time the database is copied to that particular site environment via the drush sql-sync command.

Drupal 8 complicates this scenario slightly, though. In Drupal 8, the enabled/disabled state of modules is now also stored in the configuration system. It is therefore also important to ensure that config-import does not enable or disable any modules that must remain installed or uninstalled in a specific environment. There is an additional concern at config-export time as well: in Drupal 8 site development, exported configuration files are usually committed to a version control repository. It would be undesirable if every configuration export from the development environment showed the development modules being enabled, and every configuration export from the live environment showed them being disabled. Ideally, we want to keep this noise out of the configuration exports, so that the only items that show up in the commit diff are the configuration changes intended for that commit.

The config-import and config-export commands in Drush 8 now support a new feature that make this easy.  The –skip-modules flag can be provided at either import or export time to specify the modules that should be ignored by the current operation. Using skip modules with config-import will prevent any module listed from being enabled or disabled during the import operation, regardless of any information about that module that may exist in the imported configuration. Similarly, using skip modules in config-export will cause the listed modules to keep whatever value they had in the existing export file, rather than taking on the current enabled or disabled state from the Drupal site.

To make this happen automatically, you can set a list of development modules to ignore during import and export via command-specific options in your drushrc.php file, as shown in the example below:

$command_specific[‘config-export’][‘skip-modules’] = array(‘devel’);
$command_specific[‘config-import’][‘skip-modules’] = array(‘devel’);

The best place to put this drushrc.php file is in a folder named drush just inside your Drupal root. This will ensure that all Drush operations that target this site will use these options, wherever they originate. Once you have set up your development modules to be ignored during config import and config export, you may use drush pm-enable to turn on your development modules in your development environment just once, and they will not be disabled again the next time you import your configuration files. You will still need a solution for enabling or disabling modules when you move the database between environments, such as the drush sync-enable example previously mentioned.

If you have other configuration values that you would like to vary by environment, you should use Drupal 8’s built-in configuration override system, which allows you to set specific configuration values either in your site’s settings.php file, or via configuration override hooks in a custom module. Instructions on how to do these things can be found in the configuration override system documentation.

 

 

 

Read More 2501
Read More 2502
Read More 2503
Read More 2504
Read More 2505
Read More 2506
Read More 2507
Read More 2508
Read More 2509
Read More 2510
Read More 2511
Read More 2512
Read More 2513
Read More 2514
Read More 2515
Read More 2516
Read More 2517
Read More 2518
Read More 2519
Read More 2520
Read More 2521
Read More 2522
Read More 2523
Read More 2524
Read More 2525
Read More 2526
Read More 2527
Read More 2528
Read More 2529
Read More 2530
Read More 2531
Read More 2532
Read More 2533
Read More 2534
Read More 2535
Read More 2536
Read More 2537
Read More 2538
Read More 2539
Read More 2540
Read More 2541
Read More 2542
Read More 2543
Read More 2544
Read More 2545
Read More 2546
Read More 2547
Read More 2548
Read More 2549
Read More 2550
Read More 2551
Read More 2552
Read More 2553
Read More 2554
Read More 2555
Read More 2556
Read More 2557
Read More 2558
Read More 2559
Read More 2560
Read More 2561
Read More 2562
Read More 2563
Read More 2564
Read More 2565
Read More 2566
Read More 2567
Read More 2568
Read More 2569
Read More 2570
Read More 2571
Read More 2572
Read More 2573
Read More 2574
Read More 2575
Read More 2576
Read More 2577
Read More 2578
Read More 2579
Read More 2580
Read More 2581
Read More 2582
Read More 2583
Read More 2584
Read More 2585
Read More 2586
Read More 2587
Read More 2588
Read More 2589
Read More 2590
Read More 2591
Read More 2592
Read More 2593
Read More 2594
Read More 2595
Read More 2596
Read More 2597
Read More 2598
Read More 2599
Read More 2600
Read More 2601
Read More 2602
Read More 2603
Read More 2604
Read More 2605
Read More 2606
Read More 2607
Read More 2608
Read More 2609
Read More 2610
Read More 2611
Read More 2612
Read More 2613
Read More 2614
Read More 2615
Read More 2616
Read More 2617
Read More 2618
Read More 2619
Read More 2620
Read More 2621
Read More 2622
Read More 2623
Read More 2624
Read More 2625
Read More 2626
Read More 2627
Read More 2628
Read More 2629
Read More 2630
Read More 2631
Read More 2632
Read More 2633
Read More 2634
Read More 2635
Read More 2636
Read More 2637
Read More 2638
Read More 2639
Read More 2640
Read More 2641
Read More 2642
Read More 2643
Read More 2644
Read More 2645
Read More 2646
Read More 2647
Read More 2648
Read More 2649
Read More 2650
Read More 2651
Read More 2652
Read More 2653
Read More 2654
Read More 2655
Read More 2656
Read More 2657
Read More 2658
Read More 2659
Read More 2660
Read More 2661
Read More 2662
Read More 2663
Read More 2664
Read More 2665
Read More 2666
Read More 2667
Read More 2668
Read More 2669
Read More 2670
Read More 2671
Read More 2672
Read More 2673
Read More 2674
Read More 2675
Read More 2676
Read More 2677
Read More 2678
Read More 2679
Read More 2680
Read More 2681
Read More 2682
Read More 2683
Read More 2684
Read More 2685
Read More 2686
Read More 2687
Read More 2688
Read More 2689
Read More 2690
Read More 2691
Read More 2692
Read More 2693
Read More 2694
Read More 2695
Read More 2696
Read More 2697
Read More 2698
Read More 2699
Read More 2700
Read More 2701
Read More 2702
Read More 2703
Read More 2704
Read More 2705
Read More 2706
Read More 2707
Read More 2708
Read More 2709
Read More 2710
Read More 2711
Read More 2712
Read More 2713
Read More 2714
Read More 2715
Read More 2716
Read More 2717
Read More 2718
Read More 2719
Read More 2720
Read More 2721
Read More 2722
Read More 2723
Read More 2724
Read More 2725
Read More 2726
Read More 2727
Read More 2728
Read More 2729
Read More 2730
Read More 2731
Read More 2732
Read More 2733
Read More 2734
Read More 2735
Read More 2736
Read More 2737
Read More 2738
Read More 2739
Read More 2740
Read More 2741
Read More 2742
Read More 2743
Read More 2744
Read More 2745
Read More 2746
Read More 2747
Read More 2748
Read More 2749
Read More 2750
Read More 2751
Read More 2752
Read More 2753
Read More 2754
Read More 2755
Read More 2756
Read More 2757
Read More 2758
Read More 2759
Read More 2760
Read More 2761
Read More 2762
Read More 2763
Read More 2764
Read More 2765
Read More 2766
Read More 2767
Read More 2768
Read More 2769
Read More 2770
Read More 2771
Read More 2772
Read More 2773
Read More 2774
Read More 2775
Read More 2776
Read More 2777
Read More 2778
Read More 2779
Read More 2780
Read More 2781
Read More 2782
Read More 2783
Read More 2784
Read More 2785
Read More 2786
Read More 2787
Read More 2788
Read More 2789
Read More 2790
Read More 2791
Read More 2792
Read More 2793
Read More 2794
Read More 2795
Read More 2796
Read More 2797
Read More 2798
Read More 2799
Read More 2800
Read More 2801
Read More 2802
Read More 2803
Read More 2804
Read More 2805
Read More 2806
Read More 2807
Read More 2808
Read More 2809
Read More 2810
Read More 2811
Read More 2812
Read More 2813
Read More 2814
Read More 2815
Read More 2816
Read More 2817
Read More 2818
Read More 2819
Read More 2820
Read More 2821
Read More 2822
Read More 2823
Read More 2824
Read More 2825
Read More 2826
Read More 2827
Read More 2828
Read More 2829
Read More 2830
Read More 2831
Read More 2832
Read More 2833
Read More 2834
Read More 2835
Read More 2836
Read More 2837
Read More 2838
Read More 2839
Read More 2840
Read More 2841
Read More 2842
Read More 2843
Read More 2844
Read More 2845
Read More 2846
Read More 2847
Read More 2848
Read More 2849
Read More 2850
Read More 2851
Read More 2852
Read More 2853
Read More 2854
Read More 2855
Read More 2856
Read More 2857
Read More 2858
Read More 2859
Read More 2860
Read More 2861
Read More 2862
Read More 2863
Read More 2864
Read More 2865
Read More 2866
Read More 2867
Read More 2868
Read More 2869
Read More 2870
Read More 2871
Read More 2872
Read More 2873
Read More 2874
Read More 2875
Read More 2876
Read More 2877
Read More 2878
Read More 2879
Read More 2880
Read More 2881
Read More 2882
Read More 2883
Read More 2884
Read More 2885
Read More 2886
Read More 2887
Read More 2888
Read More 2889
Read More 2890
Read More 2891
Read More 2892
Read More 2893
Read More 2894
Read More 2895
Read More 2896
Read More 2897
Read More 2898
Read More 2899
Read More 2900
Read More 2901
Read More 2902
Read More 2903
Read More 2904
Read More 2905
Read More 2906
Read More 2907
Read More 2908
Read More 2909
Read More 2910
Read More 2911
Read More 2912
Read More 2913
Read More 2914
Read More 2915
Read More 2916
Read More 2917
Read More 2918
Read More 2919
Read More 2920
Read More 2921
Read More 2922
Read More 2923
Read More 2924
Read More 2925
Read More 2926
Read More 2927
Read More 2928
Read More 2929
Read More 2930
Read More 2931
Read More 2932
Read More 2933
Read More 2934
Read More 2935
Read More 2936
Read More 2937
Read More 2938
Read More 2939
Read More 2940
Read More 2941
Read More 2942
Read More 2943
Read More 2944
Read More 2945
Read More 2946
Read More 2947
Read More 2948
Read More 2949
Read More 2950
Read More 2951
Read More 2952
Read More 2953
Read More 2954
Read More 2955
Read More 2956
Read More 2957
Read More 2958
Read More 2959
Read More 2960
Read More 2961
Read More 2962
Read More 2963
Read More 2964
Read More 2965
Read More 2966
Read More 2967
Read More 2968
Read More 2969
Read More 2970
Read More 2971
Read More 2972
Read More 2973
Read More 2974
Read More 2975
Read More 2976
Read More 2977
Read More 2978
Read More 2979
Read More 2980
Read More 2981
Read More 2982
Read More 2983
Read More 2984
Read More 2985
Read More 2986
Read More 2987
Read More 2988
Read More 2989
Read More 2990
Read More 2991
Read More 2992
Read More 2993
Read More 2994
Read More 2995
Read More 2996
Read More 2997
Read More 2998
Read More 2999
Read More 3000