Upload webpages/1037.html with huggingface_hub
Browse files- webpages/1037.html +264 -0
    	
        webpages/1037.html
    ADDED
    
    | @@ -0,0 +1,264 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            <!DOCTYPE html>
         | 
| 2 | 
            +
            <html class="no-js" lang="en">
         | 
| 3 | 
            +
             <!--<![endif]-->
         | 
| 4 | 
            +
             <head>
         | 
| 5 | 
            +
              <style>
         | 
| 6 | 
            +
               @charset "UTF-8";article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none}[hidden]{display:none}html{font-size:100%;overflow-y:scroll;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0;font-size:13px;line-height:1.231}body,button,input,select,textarea{font-family:sans-serif;color:#222020}::-moz-selection{background:#fe57a1;color:#fff;text-shadow:none}::selection{background:#fe57a1;color:#fff;text-shadow:none}a{color:#00e}a:visited{color:#551a8b}a:hover{color:#06e}a:focus{outline:thin dotted}a:hover,a:active{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}blockquote{margin:1em 40px}dfn{font-style:italic}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0}ins{background:#ff9;color:#000;text-decoration:none}mark{background:#ff0;color:#000;font-style:italic;font-weight:700}pre,code,kbd,samp{font-family:monospace,monospace;_font-family:'courier new',monospace;font-size:1em}pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word}q{quotes:none}q:before,q:after{content:"";content:none}small{font-size:85%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}ul{margin:1em 0;padding:0 0 0 50px}ol{margin:1em 0;padding:0 0 0 60px}dd{margin:0 0 0 40px}nav ul,nav ol{list-style:none;list-style-image:none;margin:0;padding:0}img{border:0;-ms-interpolation-mode:bicubic;vertical-align:middle}svg:not(:root){overflow:hidden}figure{margin:0}form{margin:0}fieldset{border:0;margin:0;padding:0}label{cursor:pointer}legend{border:0;*margin-left:-7px;padding:0}button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}button,input{line-height:normal;*overflow:visible}table button,table input{*overflow:auto}button,input[type=button],input[type=reset],input[type=submit]{cursor:pointer;-webkit-appearance:button}input[type=checkbox],input[type=radio]{box-sizing:border-box}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top;resize:vertical}input:invalid,textarea:invalid{background-color:#f0dddd}table{border-collapse:collapse;border-spacing:0}td{vertical-align:top}body{font-family:minion pro,palatino,hoefler text,times new roman,serif}header,footer,p,h2,h3,th,td,li,dd,dt,blockquote{font-size:1.4em}li li{font-size:1em}li p{font-size:1em}pre{font-size:1rem;font-family:monaco,monospace,sans-serif;line-height:1.4em}code{font-family:monaco,monospace,sans-serif}dt{font-weight:700}ul,ol{list-style-position:outside;margin:0 0 0 3em;padding:0}a,a:active,a.link,a:visited,a:hover{text-decoration:none;color:#8c0808}p,li,dd,dt,blockquote{max-width:35em;line-height:1.5em}dl dd p{font-size:1em}li{margin:5px 0}dt{margin-top:10px}sup{padding:0 0 0 4px;font-weight:700}#container{margin:0 auto 100px;position:relative;width:90%;max-width:820px;overflow:hidden;padding:0 2em}header{overflow:hidden;font-size:1em}header a:hover{text-decoration:underline}#logo{color:#222}#logo h1,#logo h2,#logo h3,#logo h4,#logo h5{font-family:monaco,monospace,sans-serif;font-weight:400;margin:0;padding:0}#logo h1{font-size:4em;margin-top:.2em}#logo h2{font-size:1.8em}#logo h3{margin:.3em 0 1em}#logo h3#mobile_nav{display:none}#logo h4{font-size:2em;text-align:right}#logo h4 a{color:#222}#logo h5{text-align:right;font-size:1.1em}#logo h5 a{color:#222}#article_nav{color:#222;margin:5px 0 30px;padding-right:10px}#article_nav h5{font-family:monaco,monospace,sans-serif;font-weight:400;font-size:1.1em;margin:0;padding:0;text-align:right}#article_nav h5 a{color:#222}footer{margin:100px 0 40px;color:#aaa;font-size:1.1em;line-height:1.5em}footer a:active,footer a:link,footer a:visited,footer a:hover{color:#aaa}footer a:hover{text-decoration:underline}.mobile_only{display:none}.home #logo{text-align:center}.home h2{font-family:signika negative,serif;font-size:2em;font-weight:400;color:#222;margin:0 0 10px;padding:0;clear:left}.home li{margin:8px 0}.home #bio{font-size:1.4em;margin-bottom:10px}.home #bio p{width:auto;margin:5px 0;font-size:1em}.home a.read-more{display:block;text-align:right;padding:5px 0;font-size:10pt}#about-photo{float:right;margin:0 0 10px 10px;border:2px solid #ccc;padding:2px}.articles{padding:0;font-size:1.4em;margin-bottom:20px}.articles h1#title{font-family:signika negative,serif;font-size:3em;font-weight:400;color:#222;margin:0;padding:0}.articles p{font-size:1em}.articles p code{font-size:.85em}.articles .article_summary{border-bottom:1px dotted #ddd;overflow:hidden;padding:.5em 0}.articles .article_summary p{font-size:1em}.articles .article_summary p code{font-size:.85em}.articles .article_summary .meta{float:right;width:30%;text-align:right;color:#666;font-size:.85em}.articles .article_summary .meta a{color:#974747}.articles .article_summary .main a{display:block}.articles .article_summary .main p{font-size:1em;margin:.1em 0 0}.article{}.article h1#article_title{font-family:signika negative,serif;color:#8c0808;font-weight:400;font-size:3.7em;margin:.3em 0 .2em;text-align:left;line-height:1.1}.article h1#title{font-family:signika negative,serif;font-size:4em;font-weight:400;color:#222;margin:0;padding:0}.article p{margin:10px 0}.article p code{border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;background-color:#eee;padding:2px 3px;font-size:.85em}.article li code{border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;background-color:#eee;padding:2px 3px;font-size:1rem}.article li{}.article li div.highlight code{background-color:#272822;padding:0}.article img.title-image{margin:20px 0 0;width:100%}.article h1{font-family:signika negative,serif;color:#8c0808;font-weight:400;font-size:2em;margin-top:1em}.article h1 code{font-size:.85em}.article h2{font-family:signika negative,serif;color:#8c0808;font-weight:400;font-size:1.8em;margin:20px 0 10px}.article h2 code{font-size:.85em}.article h3{font-family:signika negative,serif;color:#8c0808;font-weight:400;font-size:1.6em;margin:10px 0}.article h3 code{font-size:.85em}.article h4{font-family:signika negative,serif;color:#8c0808;font-weight:400;font-size:1.4em;margin:10px 0}.article h4 code{font-size:.85em}.article .byline{font-family:signika negative,serif;color:#8c0808;font-weight:400;color:#974747;font-size:1.4em;text-align:left;margin:0 0 30px}.article blockquote{background-color:#eee;border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;padding:.8em 1em;font-style:italic;margin:1em 0 0}.article blockquote p{font-size:1em;margin:0;padding:.4em 0}.article div.slidedeck{width:90%;max-width:45em}.article div.warning{background-color:#eee;border:1px solid #ddd;color:#555;padding:1em;margin-top:20px;font-size:1.4em;line-height:1.5em;width:38em}.article div.warning p{margin:0}.article img.align-right{float:right;padding:2px;margin:0 0 2em 1em;background-color:#fff;border:1px solid #aaa}.article img.noborder{border:none}.article img.screenshot{background-color:#fff;border:1px dashed #aaa;padding:8px 12px}.article img.photo{width:100%;padding:0;margin:0 0 1em;border:2px solid #aaa}.article figure img{width:70%}.article figure figcaption h4{text-align:left;color:#aaa;font-family:minion pro,palatino,hoefler text,times new roman,serif;font-style:italic}.article .highlight{border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;width:95%;max-width:790px;padding:10px 10px 10px 20px}.article .highlight pre{margin:0}.article .keys{border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;background-color:#ddd;color:#000;padding:3px 7px;font-family:monaco,monospace,sans-serif;border:1px solid #ccc;font-size:.9em}.article nav#TableOfContents ul{list-style:none;padding-left:0}.article nav#TableOfContents ul ul{list-style:disc inside;padding-left:20px}.article nav#TableOfContents ul ul ul{list-style:circle inside}.article nav#TableOfContents ul ul ul li{font-size:.9em}.article nav#TableOfContents ul ul ul li code{font-size:.9em}.article div.footnotes{margin:80px 0 40px;font-size:.8em}.article div.footnotes ol{margin:40px 0 0 15px}.article div.footnotes ol li{max-width:none}.article div.footnotes ol li p{max-width:none;margin:0 0 4px}.article div.footnotes ul{margin:0 0 0 14px}.article div.footnotes div.highlight{margin:0 0 6px}.article div.footnotes code{font-size:.8em}.article #article_meta{font-size:.8em;margin-top:80px}.article #article_meta span.hr{color:#aaa}.article #article_meta p{max-width:none}.ir{display:block;border:0;text-indent:-999em;overflow:hidden;background-color:transparent;background-repeat:no-repeat;text-align:left;direction:ltr}.ir br{display:none}.hidden{display:none!important;visibility:hidden}.visuallyhidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}.invisible{visibility:hidden}.clearfix:before,.clearfix:after{content:"";display:table}.clearfix:after{clear:both}.clearfix{zoom:1}@media screen and (min-width:10px) and (max-width:480px){#container{padding:0 10px;margin-bottom:20px}.desktop_only{display:none}.mobile_only{display:block}.home #logo{margin-bottom:20px}.home h2{font-size:1.4em}.home #about-photo{display:none}#logo h1{font-size:2.6em}#logo h3#screen_nav{display:none}#logo h3#mobile_nav{margin-top:0;display:block}#logo h4{text-align:center}#logo h5{text-align:center;padding-bottom:15px}.articles h1#title{font-size:2em}.articles .article_summary .meta{width:100%;text-align:left;padding-bottom:5px}.articles .article_summary .meta .tags{display:none}#article_nav{padding:0}#article_nav h5{text-align:center}.article{}.article h1#article_title{font-size:2.5em;padding-left:0}.article h1#title{font-size:2.8em;padding-left:0}.article nav#TableOfContents ul{padding:0;margin:0}.article nav#TableOfContents ul ul{padding:0;margin:0}.article nav#TableOfContents ul ul ul{padding-left:20px}.article .article_date{font-size:.8em}.article #nav{float:none}.article .caption{margin:0}.article ul{padding-left:0;margin-left:15px}.article #article_content p,.article #article_content dl,.article #article_content table{margin-left:0;padding-left:0}.article img.align-right{display:none}.article .highlight{width:auto}}@media only screen and (min-width:480px){}@media only screen and (min-width:768px){}@media print{*{background:0 0!important;color:#000!important;text-shadow:none!important;filter:none!important;-ms-filter:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href)")"}abbr[title]:after{content:" (" attr(title)")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100%!important}@page{margin:.5cm}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}}.highlight .hll{background-color:#49483e}.highlight{background:#272822;color:#f8f8f2}.highlight .c{color:#75715e}.highlight .err{color:#960050;background-color:#1e0010}.highlight .k{color:#66d9ef}.highlight .l{color:#ae81ff}.highlight .n{color:#f8f8f2}.highlight .o{color:#f92672}.highlight .p{color:#f8f8f2}.highlight .cm{color:#75715e}.highlight .cp{color:#75715e}.highlight .c1{color:#75715e}.highlight .cs{color:#75715e}.highlight .ge{font-style:italic}.highlight .gs{font-weight:700}.highlight .kc{color:#66d9ef}.highlight .kd{color:#66d9ef}.highlight .kn{color:#f92672}.highlight .kp{color:#66d9ef}.highlight .kr{color:#66d9ef}.highlight .kt{color:#66d9ef}.highlight .ld{color:#e6db74}.highlight .m{color:#ae81ff}.highlight .s{color:#e6db74}.highlight .na{color:#a6e22e}.highlight .nb{color:#f8f8f2}.highlight .nc{color:#a6e22e}.highlight .no{color:#66d9ef}.highlight .nd{color:#a6e22e}.highlight .ni{color:#f8f8f2}.highlight .ne{color:#a6e22e}.highlight .nf{color:#a6e22e}.highlight .nl{color:#f8f8f2}.highlight .nn{color:#f8f8f2}.highlight .nx{color:#a6e22e}.highlight .py{color:#f8f8f2}.highlight .nt{color:#f92672}.highlight .nv{color:#f8f8f2}.highlight .ow{color:#f92672}.highlight .w{color:#f8f8f2}.highlight .mf{color:#ae81ff}.highlight .mh{color:#ae81ff}.highlight .mi{color:#ae81ff}.highlight .mo{color:#ae81ff}.highlight .sb{color:#e6db74}.highlight .sc{color:#e6db74}.highlight .sd{color:#e6db74}.highlight .s2{color:#e6db74}.highlight .se{color:#ae81ff}.highlight .sh{color:#e6db74}.highlight .si{color:#e6db74}.highlight .sx{color:#e6db74}.highlight .sr{color:#e6db74}.highlight .s1{color:#e6db74}.highlight .ss{color:#e6db74}.highlight .bp{color:#f8f8f2}.highlight .vc{color:#f8f8f2}.highlight .vg{color:#f8f8f2}.highlight .vi{color:#f8f8f2}.highlight .il{color:#ae81ff}
         | 
| 7 | 
            +
             | 
| 8 | 
            +
             | 
| 9 | 
            +
            @font-face {
         | 
| 10 | 
            +
              font-family: 'Signika Negative';
         | 
| 11 | 
            +
              font-style: normal;
         | 
| 12 | 
            +
              font-weight: 600;
         | 
| 13 | 
            +
              src: url(https://fonts.gstatic.com/s/signikanegative/v21/E21x_cfngu7HiRpPX3ZpNE4kY5zKSPmJXkF0VDD2RAp5TI3rvdw.ttf) format('truetype');
         | 
| 14 | 
            +
            }
         | 
| 15 | 
            +
              </style>
         | 
| 16 | 
            +
              <meta charset="utf-8">
         | 
| 17 | 
            +
              <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
         | 
| 18 | 
            +
              <meta content="width=device-width,initial-scale=1" name="viewport">
         | 
| 19 | 
            +
              <title>
         | 
| 20 | 
            +
               Reorganising a Consul key-value store — David Winterbottom
         | 
| 21 | 
            +
              </title>
         | 
| 22 | 
            +
              <meta content="David Winterbottom" name="author">
         | 
| 23 | 
            +
              <meta content="This is really just a reference on how to combine JQ's select filters." name="description">
         | 
| 24 | 
            +
              <meta content="AymqwRC7u88Y4JPvfIF2F37QKylC04248hLCdJAsh8xgOfe/dVJPV3XS3wLFca1ZMVOtnBfVjaCMTVudWM//5g4AAAB7eyJvcmlnaW4iOiJodHRwczovL3d3dy5nb29nbGV0YWdtYW5hZ2VyLmNvbTo0NDMiLCJmZWF0dXJlIjoiUHJpdmFjeVNhbmRib3hBZHNBUElzIiwiZXhwaXJ5IjoxNjk1MTY3OTk5LCJpc1RoaXJkUGFydHkiOnRydWV9" http-equiv="origin-trial">
         | 
| 25 | 
            +
             </head>
         | 
| 26 | 
            +
             <body>
         | 
| 27 | 
            +
              <article class="hentry" id="container">
         | 
| 28 | 
            +
               <header>
         | 
| 29 | 
            +
                <div id="article_nav">
         | 
| 30 | 
            +
                 <h5>
         | 
| 31 | 
            +
                  <a>
         | 
| 32 | 
            +
                   home
         | 
| 33 | 
            +
                  </a>
         | 
| 34 | 
            +
                  |
         | 
| 35 | 
            +
                  <a>
         | 
| 36 | 
            +
                   writing
         | 
| 37 | 
            +
                  </a>
         | 
| 38 | 
            +
                  |
         | 
| 39 | 
            +
                  <a>
         | 
| 40 | 
            +
                   TIL
         | 
| 41 | 
            +
                  </a>
         | 
| 42 | 
            +
                  |
         | 
| 43 | 
            +
                  <span class="desktop_only">
         | 
| 44 | 
            +
                   <a>
         | 
| 45 | 
            +
                    now
         | 
| 46 | 
            +
                   </a>
         | 
| 47 | 
            +
                   |
         | 
| 48 | 
            +
                  </span>
         | 
| 49 | 
            +
                  <a>
         | 
| 50 | 
            +
                   about
         | 
| 51 | 
            +
                  </a>
         | 
| 52 | 
            +
                 </h5>
         | 
| 53 | 
            +
                </div>
         | 
| 54 | 
            +
               </header>
         | 
| 55 | 
            +
               <div id="main" role="main">
         | 
| 56 | 
            +
                <div class="article" id="content">
         | 
| 57 | 
            +
                 <h1 class="entry-title" id="article_title">
         | 
| 58 | 
            +
                  Reorganising a Consul key-value store
         | 
| 59 | 
            +
                 </h1>
         | 
| 60 | 
            +
                 <div class="byline desktop_only">
         | 
| 61 | 
            +
                  by
         | 
| 62 | 
            +
                  <a class="author vcard">
         | 
| 63 | 
            +
                   David Winterbottom
         | 
| 64 | 
            +
                  </a>
         | 
| 65 | 
            +
                  on
         | 
| 66 | 
            +
                  <time class="published" datetime>
         | 
| 67 | 
            +
                   Monday, 27 March 2017
         | 
| 68 | 
            +
                  </time>
         | 
| 69 | 
            +
                 </div>
         | 
| 70 | 
            +
                 <div class="byline mobile_only">
         | 
| 71 | 
            +
                  by
         | 
| 72 | 
            +
                  <a class="author vcard">
         | 
| 73 | 
            +
                   David Winterbottom
         | 
| 74 | 
            +
                  </a>
         | 
| 75 | 
            +
                  <br>
         | 
| 76 | 
            +
                  <span class="article_date">
         | 
| 77 | 
            +
                   on
         | 
| 78 | 
            +
                   <time class="published" datetime>
         | 
| 79 | 
            +
                    Monday, 27 March 2017
         | 
| 80 | 
            +
                   </time>
         | 
| 81 | 
            +
                  </span>
         | 
| 82 | 
            +
                 </div>
         | 
| 83 | 
            +
                 <div class="entry-content" id="article_content">
         | 
| 84 | 
            +
                  <p>
         | 
| 85 | 
            +
                   If your Consul key-value store is structured as:
         | 
| 86 | 
            +
                  </p>
         | 
| 87 | 
            +
                  <div class="highlight">
         | 
| 88 | 
            +
                   <pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;" tabindex="0"><code class="language-sh" data-lang="sh"><span style="display:flex;"><span>/
         | 
| 89 | 
            +
            </span></span><span style="display:flex;"><span>    A/
         | 
| 90 | 
            +
            </span></span><span style="display:flex;"><span>        X <span style="color:#f92672">=</span> <span style="color:#ae81ff">1</span>
         | 
| 91 | 
            +
            </span></span><span style="display:flex;"><span>        Z <span style="color:#f92672">=</span> <span style="color:#ae81ff">2</span>
         | 
| 92 | 
            +
            </span></span><span style="display:flex;"><span>        Y <span style="color:#f92672">=</span> <span style="color:#ae81ff">3</span>
         | 
| 93 | 
            +
            </span></span><span style="display:flex;"><span>    C
         | 
| 94 | 
            +
            </span></span><span style="display:flex;"><span>    D
         | 
| 95 | 
            +
            </span></span></code></pre>
         | 
| 96 | 
            +
                  </div>
         | 
| 97 | 
            +
                  <p>
         | 
| 98 | 
            +
                   but you now realise you should have namespaced everything within
         | 
| 99 | 
            +
                   <code>
         | 
| 100 | 
            +
                    WEBSERVER/
         | 
| 101 | 
            +
                   </code>
         | 
| 102 | 
            +
                   (or something like that):
         | 
| 103 | 
            +
                  </p>
         | 
| 104 | 
            +
                  <div class="highlight">
         | 
| 105 | 
            +
                   <pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;" tabindex="0"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>/
         | 
| 106 | 
            +
            </span></span><span style="display:flex;"><span>    WEBSERVER/
         | 
| 107 | 
            +
            </span></span><span style="display:flex;"><span>        A/
         | 
| 108 | 
            +
            </span></span><span style="display:flex;"><span>            X <span style="color:#f92672">=</span> <span style="color:#ae81ff">1</span>
         | 
| 109 | 
            +
            </span></span><span style="display:flex;"><span>            Z <span style="color:#f92672">=</span> <span style="color:#ae81ff">2</span>
         | 
| 110 | 
            +
            </span></span><span style="display:flex;"><span>            Y <span style="color:#f92672">=</span> <span style="color:#ae81ff">3</span>
         | 
| 111 | 
            +
            </span></span><span style="display:flex;"><span>        C
         | 
| 112 | 
            +
            </span></span><span style="display:flex;"><span>        D
         | 
| 113 | 
            +
            </span></span></code></pre>
         | 
| 114 | 
            +
                  </div>
         | 
| 115 | 
            +
                  <p>
         | 
| 116 | 
            +
                   then this Bash script will help you migrate:
         | 
| 117 | 
            +
                  </p>
         | 
| 118 | 
            +
                  <div class="highlight">
         | 
| 119 | 
            +
                   <pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;" tabindex="0"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e">#!/bin/bash
         | 
| 120 | 
            +
            </span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>
         | 
| 121 | 
            +
            </span></span><span style="display:flex;"><span>set -e  <span style="color:#75715e"># Exit on error</span>
         | 
| 122 | 
            +
            </span></span><span style="display:flex;"><span>
         | 
| 123 | 
            +
            </span></span><span style="display:flex;"><span><span style="color:#75715e"># Emit "key value" lines for all keys in Consul's KV store</span>
         | 
| 124 | 
            +
            </span></span><span style="display:flex;"><span>keys_and_values<span style="color:#f92672">()</span> <span style="color:#f92672">{</span>
         | 
| 125 | 
            +
            </span></span><span style="display:flex;"><span>    <span style="color:#75715e"># Recursively fetch all values from Consul but exclude:</span>
         | 
| 126 | 
            +
            </span></span><span style="display:flex;"><span>    <span style="color:#75715e"># (a) those that end in / (as these are folders)</span>
         | 
| 127 | 
            +
            </span></span><span style="display:flex;"><span>    <span style="color:#75715e"># (b) those that start with WEBSERVER/ (as that's where we are migrating</span>
         | 
| 128 | 
            +
            </span></span><span style="display:flex;"><span>    <span style="color:#75715e">#     to).</span>
         | 
| 129 | 
            +
            </span></span><span style="display:flex;"><span>    curl -s <span style="color:#e6db74">"localhost/v1/kv/?recurse"</span> | jq -r <span style="color:#e6db74">'
         | 
| 130 | 
            +
            </span></span></span><span style="display:flex;"><span><span style="color:#e6db74">        .[] |
         | 
| 131 | 
            +
            </span></span></span><span style="display:flex;"><span><span style="color:#e6db74">        select(
         | 
| 132 | 
            +
            </span></span></span><span style="display:flex;"><span><span style="color:#e6db74">            (.Key | endswith("/") | not) and
         | 
| 133 | 
            +
            </span></span></span><span style="display:flex;"><span><span style="color:#e6db74">            (.Key | startswith("WEBSERVER") | not)
         | 
| 134 | 
            +
            </span></span></span><span style="display:flex;"><span><span style="color:#e6db74">        ) |
         | 
| 135 | 
            +
            </span></span></span><span style="display:flex;"><span><span style="color:#e6db74">        [.Key, " ", .Value] |
         | 
| 136 | 
            +
            </span></span></span><span style="display:flex;"><span><span style="color:#e6db74">        add'</span> | <span style="color:#66d9ef">while</span> read key b64value
         | 
| 137 | 
            +
            </span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">do</span>
         | 
| 138 | 
            +
            </span></span><span style="display:flex;"><span>        <span style="color:#75715e"># Consul's REST API returns values base64-encoded so we decode here.</span>
         | 
| 139 | 
            +
            </span></span><span style="display:flex;"><span>        echo $key <span style="color:#e6db74">`</span>echo <span style="color:#e6db74">"</span>$b64value<span style="color:#e6db74">"</span> | base64 -d<span style="color:#e6db74">`</span>
         | 
| 140 | 
            +
            </span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">done</span>
         | 
| 141 | 
            +
            </span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
         | 
| 142 | 
            +
            </span></span><span style="display:flex;"><span>
         | 
| 143 | 
            +
            </span></span><span style="display:flex;"><span><span style="color:#75715e"># Set a new value in Consul's KV store</span>
         | 
| 144 | 
            +
            </span></span><span style="display:flex;"><span>set_key<span style="color:#f92672">()</span> <span style="color:#f92672">{</span>
         | 
| 145 | 
            +
            </span></span><span style="display:flex;"><span>    key<span style="color:#f92672">=</span>$1
         | 
| 146 | 
            +
            </span></span><span style="display:flex;"><span>    value<span style="color:#f92672">=</span>$2
         | 
| 147 | 
            +
            </span></span><span style="display:flex;"><span>    curl -s -X PUT -d <span style="color:#e6db74">"</span>$value<span style="color:#e6db74">"</span> <span style="color:#e6db74">"localhost/v1/kv/</span>$key<span style="color:#e6db74">"</span> > /dev/null
         | 
| 148 | 
            +
            </span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
         | 
| 149 | 
            +
            </span></span><span style="display:flex;"><span>
         | 
| 150 | 
            +
            </span></span><span style="display:flex;"><span>migrate_to_webserver_namespace<span style="color:#f92672">()</span> <span style="color:#f92672">{</span>
         | 
| 151 | 
            +
            </span></span><span style="display:flex;"><span>    keys_and_values | <span style="color:#66d9ef">while</span> read key value
         | 
| 152 | 
            +
            </span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">do</span>
         | 
| 153 | 
            +
            </span></span><span style="display:flex;"><span>        set_key <span style="color:#e6db74">"WEBSERVER/</span>$key<span style="color:#e6db74">"</span> <span style="color:#e6db74">"</span>$value<span style="color:#e6db74">"</span>
         | 
| 154 | 
            +
            </span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">done</span>
         | 
| 155 | 
            +
            </span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
         | 
| 156 | 
            +
            </span></span><span style="display:flex;"><span>
         | 
| 157 | 
            +
            </span></span><span style="display:flex;"><span>migrate_to_webserver_namespace
         | 
| 158 | 
            +
            </span></span></code></pre>
         | 
| 159 | 
            +
                  </div>
         | 
| 160 | 
            +
                  <p>
         | 
| 161 | 
            +
                   This script uses
         | 
| 162 | 
            +
                   <a>
         | 
| 163 | 
            +
                    Consul’s REST API
         | 
| 164 | 
            +
                   </a>
         | 
| 165 | 
            +
                   and filters
         | 
| 166 | 
            +
            the results using
         | 
| 167 | 
            +
                   <a>
         | 
| 168 | 
            +
                    <code>
         | 
| 169 | 
            +
                     jq
         | 
| 170 | 
            +
                    </code>
         | 
| 171 | 
            +
                   </a>
         | 
| 172 | 
            +
                   <sup id="fnref:1">
         | 
| 173 | 
            +
                    <a class="footnote-ref" role="doc-noteref">
         | 
| 174 | 
            +
                     1
         | 
| 175 | 
            +
                    </a>
         | 
| 176 | 
            +
                   </sup>
         | 
| 177 | 
            +
                   . It’s easily
         | 
| 178 | 
            +
            adapted to migrate key-value pairs between different namespaces.
         | 
| 179 | 
            +
                  </p>
         | 
| 180 | 
            +
                  <div class="footnotes" role="doc-endnotes">
         | 
| 181 | 
            +
                   <hr>
         | 
| 182 | 
            +
                   <ol>
         | 
| 183 | 
            +
                    <li id="fn:1">
         | 
| 184 | 
            +
                     <p>
         | 
| 185 | 
            +
                      I can never remember jq’s
         | 
| 186 | 
            +
                      <code>
         | 
| 187 | 
            +
                       select
         | 
| 188 | 
            +
                      </code>
         | 
| 189 | 
            +
                      syntax so this post is intended largely
         | 
| 190 | 
            +
            as a personal reference on how to do this. 
         | 
| 191 | 
            +
                      <a class="footnote-backref" role="doc-backlink">
         | 
| 192 | 
            +
                       ↩︎
         | 
| 193 | 
            +
                      </a>
         | 
| 194 | 
            +
                     </p>
         | 
| 195 | 
            +
                    </li>
         | 
| 196 | 
            +
                   </ol>
         | 
| 197 | 
            +
                  </div>
         | 
| 198 | 
            +
                 </div>
         | 
| 199 | 
            +
                 <div id="article_meta">
         | 
| 200 | 
            +
                  <span class="hr">
         | 
| 201 | 
            +
                   ——————
         | 
| 202 | 
            +
                  </span>
         | 
| 203 | 
            +
                  <p>
         | 
| 204 | 
            +
                   Something wrong?
         | 
| 205 | 
            +
                   <a>
         | 
| 206 | 
            +
                    Suggest an improvement
         | 
| 207 | 
            +
                   </a>
         | 
| 208 | 
            +
                   or
         | 
| 209 | 
            +
                   <a>
         | 
| 210 | 
            +
                    add a comment
         | 
| 211 | 
            +
                   </a>
         | 
| 212 | 
            +
                   (see
         | 
| 213 | 
            +
                   <a>
         | 
| 214 | 
            +
                    article history
         | 
| 215 | 
            +
                   </a>
         | 
| 216 | 
            +
                   )
         | 
| 217 | 
            +
                   <br>
         | 
| 218 | 
            +
                   Tagged with:
         | 
| 219 | 
            +
                   <a>
         | 
| 220 | 
            +
                    consul
         | 
| 221 | 
            +
                   </a>
         | 
| 222 | 
            +
                   ,
         | 
| 223 | 
            +
                   <a>
         | 
| 224 | 
            +
                    bash
         | 
| 225 | 
            +
                   </a>
         | 
| 226 | 
            +
                   ,
         | 
| 227 | 
            +
                   <a>
         | 
| 228 | 
            +
                    jq
         | 
| 229 | 
            +
                   </a>
         | 
| 230 | 
            +
                   <br>
         | 
| 231 | 
            +
                   Filed in:
         | 
| 232 | 
            +
                   <a>
         | 
| 233 | 
            +
                    tips
         | 
| 234 | 
            +
                   </a>
         | 
| 235 | 
            +
                  </p>
         | 
| 236 | 
            +
                  <p>
         | 
| 237 | 
            +
                   Previous:
         | 
| 238 | 
            +
                   <a>
         | 
| 239 | 
            +
                    Lies you're told on a software project
         | 
| 240 | 
            +
                   </a>
         | 
| 241 | 
            +
                   <br>
         | 
| 242 | 
            +
                   Next:
         | 
| 243 | 
            +
                   <a>
         | 
| 244 | 
            +
                    Podcast.__init__ on Oscar
         | 
| 245 | 
            +
                   </a>
         | 
| 246 | 
            +
                  </p>
         | 
| 247 | 
            +
                  <p>
         | 
| 248 | 
            +
                   Copyright © 2005-2023
         | 
| 249 | 
            +
                   <a>
         | 
| 250 | 
            +
                    David Winterbottom
         | 
| 251 | 
            +
                   </a>
         | 
| 252 | 
            +
                   <br>
         | 
| 253 | 
            +
                   Content licensed under
         | 
| 254 | 
            +
                   <a>
         | 
| 255 | 
            +
                    CC BY-NC-SA 4.0
         | 
| 256 | 
            +
                   </a>
         | 
| 257 | 
            +
                   .
         | 
| 258 | 
            +
                  </p>
         | 
| 259 | 
            +
                 </div>
         | 
| 260 | 
            +
                </div>
         | 
| 261 | 
            +
               </div>
         | 
| 262 | 
            +
              </article>
         | 
| 263 | 
            +
             </body>
         | 
| 264 | 
            +
            </html>
         | 
