Uncategorized

Drupal 8 Config Management – how should I add config to a D8 site?

For me this is the biggest unanswered question hanging over my development of Drupal 8 websites:

How should I add config to a Drupal 8 site?

Before I go any further I should warn you that despite providing plenty of options, this article will not provide a definitive answer. After much investigation, thought and discussion I suspect different solutions will apply in different situations – I wish there was a silver bullet; a solution that is best for every situation, but (as yet) there isn’t.

The problem

Imagine you are developing an existing Drupal 8 installation and you want to add, for example, a pre-existing view saved as a config file. How should you add that to your site? What about if you had 2 config files, or 10, or even 100 – how would you do it then?

The solutions(?)

The rest of this article will highlight some possible methods by which you could import config file(s).

/config/install directory

Config files can be added to a site as part of enabling a module by placing them in the /config/install directory of the module. This functionality is described in more depth in the drupal.org article Include default configuration in your Drupal 8 module.

If the migration of config is a one-time-only affair then this is a great option and the workflow is equally simple for any number of config files. BUT the development of a site is more often an iterative process – what happens when you need to add just one more config file? Simply adding this additional file to the /config/install directory of a currently enabled module will have no effect. In theory you could uninstall the module and then re-enable it, but this is not always an option if the module is a dependency of other modules. Besides this workflow is becoming cumbersome and is clearly not the intended functionality of the /config/install directory.

Configuration Synchronization

The apparent obvious solution to adding config would be the Configuration Synchronization user interface (Admin menu: Configuration > Development > Configuration Synchronization) and in some cases it is. The interface provides two options: import a single item of config or a full archive (for more details read Managing configuration in Drupal 8 on drupal.org).

Single item

The user interface for importing a single item of config is straightforward and ideal for that particular use case, but not if the number of config items increases. This workflow would not be suitable if there were, for example, ten or more items of config that required importing.

Full archive

Unfortunately, the alternative to “Single Item” is not “Multiple Items” it is “Full Archive” instead. In this case the workflow is as easy for one item of config as it would be for 100, but the steps can be complicated because this is not the prime intention of the functionality.

To add config via the Full Archive configuration synchronization the steps are as follows:

  1. Export the complete current configuration (/admin/config/development/configuration/full/export)
  2. Add your additional config file(s) – there are two options for doing this:a. Continue in the UI by:
    • Unzipping the config export
    • Adding the additional config file(s)
    • Zipping the new complete config
    • Uploading the new complete config zip (/admin/config/development/configuration/full/import)

    b. Or Use the file system instead of the UI by:

    • Locating the (not zipped) export of the complete config in the sync directory (by default /sites/default/files/config/sync)
    • Adding the additional config file(s)
    • Running the synchronization (/admin/config/development/configuration)

 

Read More 1
Read More 2
Read More 3
Read More 4
Read More 5
Read More 6
Read More 7
Read More 8
Read More 9
Read More 10
Read More 11
Read More 12
Read More 13
Read More 14
Read More 15
Read More 16
Read More 17
Read More 18
Read More 19
Read More 20
Read More 21
Read More 22
Read More 23
Read More 24
Read More 25
Read More 26
Read More 27
Read More 28
Read More 29
Read More 30
Read More 31
Read More 32
Read More 33
Read More 34
Read More 35
Read More 36
Read More 37
Read More 38
Read More 39
Read More 40
Read More 41
Read More 42
Read More 43
Read More 44
Read More 45
Read More 46
Read More 47
Read More 48
Read More 49
Read More 50
Read More 51
Read More 52
Read More 53
Read More 54
Read More 55
Read More 56
Read More 57
Read More 58
Read More 59
Read More 60
Read More 61
Read More 62
Read More 63
Read More 64
Read More 65
Read More 66
Read More 67
Read More 68
Read More 69
Read More 70
Read More 71
Read More 72
Read More 73
Read More 74
Read More 75
Read More 76
Read More 77
Read More 78
Read More 79
Read More 80
Read More 81
Read More 82
Read More 83
Read More 84
Read More 85
Read More 86
Read More 87
Read More 88
Read More 89
Read More 90
Read More 91
Read More 92
Read More 93
Read More 94
Read More 95
Read More 96
Read More 97
Read More 98
Read More 99
Read More 100
Read More 101
Read More 102
Read More 103
Read More 104
Read More 105
Read More 106
Read More 107
Read More 108
Read More 109
Read More 110
Read More 111
Read More 112
Read More 113
Read More 114
Read More 115
Read More 116
Read More 117
Read More 118
Read More 119
Read More 120
Read More 121
Read More 122
Read More 123
Read More 124
Read More 125
Read More 126
Read More 127
Read More 128
Read More 129
Read More 130
Read More 131
Read More 132
Read More 133
Read More 134
Read More 135
Read More 136
Read More 137
Read More 138
Read More 139
Read More 140
Read More 141
Read More 142
Read More 143
Read More 144
Read More 145
Read More 146
Read More 147
Read More 148
Read More 149
Read More 150
Read More 151
Read More 152
Read More 153
Read More 154
Read More 155
Read More 156
Read More 157
Read More 158
Read More 159
Read More 160
Read More 161
Read More 162
Read More 163
Read More 164
Read More 165
Read More 166
Read More 167
Read More 168
Read More 169
Read More 170
Read More 171
Read More 172
Read More 173
Read More 174
Read More 175
Read More 176
Read More 177
Read More 178
Read More 179
Read More 180
Read More 181
Read More 182
Read More 183
Read More 184
Read More 185
Read More 186
Read More 187
Read More 188
Read More 189
Read More 190
Read More 191
Read More 192
Read More 193
Read More 194
Read More 195
Read More 196
Read More 197
Read More 198
Read More 199
Read More 200
Read More 201
Read More 202
Read More 203
Read More 204
Read More 205
Read More 206
Read More 207
Read More 208
Read More 209
Read More 210
Read More 211
Read More 212
Read More 213
Read More 214
Read More 215
Read More 216
Read More 217
Read More 218
Read More 219
Read More 220
Read More 221
Read More 222
Read More 223
Read More 224
Read More 225
Read More 226
Read More 227
Read More 228
Read More 229
Read More 230
Read More 231
Read More 232
Read More 233
Read More 234
Read More 235
Read More 236
Read More 237
Read More 238
Read More 239
Read More 240
Read More 241
Read More 242
Read More 243
Read More 244
Read More 245
Read More 246
Read More 247
Read More 248
Read More 249
Read More 250
Read More 251
Read More 252
Read More 253
Read More 254
Read More 255
Read More 256
Read More 257
Read More 258
Read More 259
Read More 260
Read More 261
Read More 262
Read More 263
Read More 264
Read More 265
Read More 266
Read More 267
Read More 268
Read More 269
Read More 270
Read More 271
Read More 272
Read More 273
Read More 274
Read More 275
Read More 276
Read More 277
Read More 278
Read More 279
Read More 280
Read More 281
Read More 282
Read More 283
Read More 284
Read More 285
Read More 286
Read More 287
Read More 288
Read More 289
Read More 290
Read More 291
Read More 292
Read More 293
Read More 294
Read More 295
Read More 296
Read More 297
Read More 298
Read More 299
Read More 300
Read More 301
Read More 302
Read More 303
Read More 304
Read More 305
Read More 306
Read More 307
Read More 308
Read More 309
Read More 310
Read More 311
Read More 312
Read More 313
Read More 314
Read More 315
Read More 316
Read More 317
Read More 318
Read More 319
Read More 320
Read More 321
Read More 322
Read More 323
Read More 324
Read More 325
Read More 326
Read More 327
Read More 328
Read More 329
Read More 330
Read More 331
Read More 332
Read More 333
Read More 334
Read More 335
Read More 336
Read More 337
Read More 338
Read More 339
Read More 340
Read More 341
Read More 342
Read More 343
Read More 344
Read More 345
Read More 346
Read More 347
Read More 348
Read More 349
Read More 350
Read More 351
Read More 352
Read More 353
Read More 354
Read More 355
Read More 356
Read More 357
Read More 358
Read More 359
Read More 360
Read More 361
Read More 362
Read More 363
Read More 364
Read More 365
Read More 366
Read More 367
Read More 368
Read More 369
Read More 370
Read More 371
Read More 372
Read More 373
Read More 374
Read More 375
Read More 376
Read More 377
Read More 378
Read More 379
Read More 380
Read More 381
Read More 382
Read More 383
Read More 384
Read More 385
Read More 386
Read More 387
Read More 388
Read More 389
Read More 390
Read More 391
Read More 392
Read More 393
Read More 394
Read More 395
Read More 396
Read More 397
Read More 398
Read More 399
Read More 400
Read More 401
Read More 402
Read More 403
Read More 404
Read More 405
Read More 406
Read More 407
Read More 408
Read More 409
Read More 410
Read More 411
Read More 412
Read More 413
Read More 414
Read More 415
Read More 416
Read More 417
Read More 418
Read More 419
Read More 420
Read More 421
Read More 422
Read More 423
Read More 424
Read More 425
Read More 426
Read More 427
Read More 428
Read More 429
Read More 430
Read More 431
Read More 432
Read More 433
Read More 434
Read More 435
Read More 436
Read More 437
Read More 438
Read More 439
Read More 440
Read More 441
Read More 442
Read More 443
Read More 444
Read More 445
Read More 446
Read More 447
Read More 448
Read More 449
Read More 450
Read More 451
Read More 452
Read More 453
Read More 454
Read More 455
Read More 456
Read More 457
Read More 458
Read More 459
Read More 460
Read More 461
Read More 462
Read More 463
Read More 464
Read More 465
Read More 466
Read More 467
Read More 468
Read More 469
Read More 470
Read More 471
Read More 472
Read More 473
Read More 474
Read More 475
Read More 476
Read More 477
Read More 478
Read More 479
Read More 480
Read More 481
Read More 482
Read More 483
Read More 484
Read More 485
Read More 486
Read More 487
Read More 488
Read More 489
Read More 490
Read More 491
Read More 492
Read More 493
Read More 494
Read More 495
Read More 496
Read More 497
Read More 498
Read More 499
Read More 500

Related Articles

Leave a Reply

Back to top button