Repository: ory/kratos
Pull request #866 (2020-12-01 11:23:20)

docs: add contributing to sidebar
The same change as in https://github.com/ory/hydra/pull/2209

## Related issue

<!--
Please link the GitHub issue this pull request resolves in the format of `#1234`. If you discussed this change
with a maintainer, please mention her/him using the `@` syntax (e.g. `@aeneasr`).

If this change neither resolves an existing issue nor has sign-off from one of the maintainers, there is a
chance substantial changes will be requested or that the changes will be rejected.

You can discuss changes with maintainers either in the [ORY Community Forums](https://community.ory.sh/) or
join the [ORY Chat](https://www.ory.sh/chat).
-->

## Proposed changes

<!--
Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request.
-->

## Checklist

<!--
Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of
them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.
-->

- [x] I have read the [contributing guidelines](../blob/master/CONTRIBUTING.md).
- [x] I have read the [security policy](../security/policy).
- [x] I confirm that this pull request does not address a security
      vulnerability. If this pull request addresses a security. vulnerability, I
      confirm that I got green light (please contact
      [security@ory.sh](mailto:security@ory.sh)) from the maintainers to push
      the changes.
- [x] I have added tests that prove my fix is effective or that my feature
      works.
- [x] I have added or changed [the documentation](docs/docs).

## Further comments

<!--
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution
you did and what alternatives you considered, etc...
-->



Patch:
diff --git a/docs/package.json b/docs/package.json
index a06ec55f4..9838f38df 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -4,7 +4,7 @@
   "private": true,
   "prettier": "ory-prettier-styles",
   "config": {
-    "prettierTarget": "{docs/**,docs,scripts,static,contrib}/*.{md,mdx,json,js,css,html}|*.{js,md}"
+    "prettierTarget": "{docs/**,docs,scripts,static,contrib,src,src/**}/*.{md,mdx,json,js,css,html}|*.{js,md}"
   },
   "scripts": {
     "gen": "npm run widdershins && cd .. && node ./docs/scripts/fix-api.js ./docs/docs/reference/api.mdx && node ./docs/scripts/config.js docs/config.js",
diff --git a/docs/sidebar.json b/docs/sidebar.json
index 5f7f8aa39..ccccde2d7 100644
--- a/docs/sidebar.json
+++ b/docs/sidebar.json
@@ -1,5 +1,5 @@
 {
-  "Introduction": ["index", "quickstart", "install", "configuring"],
+  "Introduction": ["index", "quickstart", "install", "configuring", "contributing"],
   "Concepts": [
     "concepts/index", 
     "concepts/terminology", 
diff --git a/docs/src/pages/versions.js b/docs/src/pages/versions.js
index 7933999d7..044bc4561 100644
--- a/docs/src/pages/versions.js
+++ b/docs/src/pages/versions.js
@@ -5,33 +5,34 @@
  * LICENSE file in the root directory of this source tree.
  */
 
-import React from 'react';
-import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
-import Link from '@docusaurus/Link';
-import Layout from '@theme/Layout';
+import React from 'react'
+import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
+import Link from '@docusaurus/Link'
+import Layout from '@theme/Layout'
 
-import {useVersions, useLatestVersion} from '@theme/hooks/useDocs';
+import { useVersions, useLatestVersion } from '@theme/hooks/useDocs'
 
 function capitalizeFirstLetter(string) {
-  return string.charAt(0).toUpperCase() + string.slice(1);
+  return string.charAt(0).toUpperCase() + string.slice(1)
 }
 
 function Version() {
-  const {siteConfig} = useDocusaurusContext();
-  const versions = useVersions();
-  const latestVersion = useLatestVersion();
-  const currentVersion = versions.find((version) => version.name === 'current');
+  const { siteConfig } = useDocusaurusContext()
+  const versions = useVersions()
+  const latestVersion = useLatestVersion()
+  const currentVersion = versions.find((version) => version.name === 'current')
   const pastVersions = versions.filter(
-    (version) => version !== latestVersion && version.name !== 'current',
-  );
-  const repoUrl = `https://github.com/${siteConfig.organizationName}/${siteConfig.projectName}`;
+    (version) => version !== latestVersion && version.name !== 'current'
+  )
+  const repoUrl = `https://github.com/${siteConfig.organizationName}/${siteConfig.projectName}`
   const project = `ORY ${capitalizeFirstLetter(siteConfig.projectName)}`
 
   return (
     <Layout
       title="Versions"
       permalink="/versions"
-      description={`Overview of all ${project} documentation versions.`}>
+      description={`Overview of all ${project} documentation versions.`}
+    >
       <main className="container margin-vert--lg">
         <h1>{project} documentation versions</h1>
 
@@ -42,17 +43,15 @@ function Version() {
           </p>
           <table>
             <tbody>
-            <tr>
-              <th>{latestVersion.name}</th>
-              <td>
-                <Link to={latestVersion.path}>Documentation</Link>
-              </td>
-              <td>
-                <a href={`${repoUrl}/blob/master/CHANGELOG.md`}>
-                  Changelog
-                </a>
-              </td>
-            </tr>
+              <tr>
+                <th>{latestVersion.name}</th>
+                <td>
+                  <Link to={latestVersion.path}>Documentation</Link>
+                </td>
+                <td>
+                  <a href={`${repoUrl}/blob/master/CHANGELOG.md`}>Changelog</a>
+                </td>
+              </tr>
             </tbody>
           </table>
         </div>
@@ -63,15 +62,15 @@ function Version() {
             <p>Here you can find the documentation for unreleased version.</p>
             <table>
               <tbody>
-              <tr>
-                <th>next</th>
-                <td>
-                  <Link to={currentVersion.path}>Documentation</Link>
-                </td>
-                <td>
-                  <a href={repoUrl}>Source Code</a>
-                </td>
-              </tr>
+                <tr>
+                  <th>next</th>
+                  <td>
+                    <Link to={currentVersion.path}>Documentation</Link>
+                  </td>
+                  <td>
+                    <a href={repoUrl}>Source Code</a>
+                  </td>
+                </tr>
               </tbody>
             </table>
           </div>
@@ -80,31 +79,29 @@ function Version() {
         {pastVersions.length > 0 && (
           <div className="margin-bottom--lg">
             <h3 id="archive">Past versions (Not maintained anymore)</h3>
-            <p>
-              Here you can find documentation for previous versions.
-            </p>
+            <p>Here you can find documentation for previous versions.</p>
             <table>
               <tbody>
-              {pastVersions.map((version) => (
-                <tr key={version.name}>
-                  <th>{version.label}</th>
-                  <td>
-                    <Link to={version.path}>Documentation</Link>
-                  </td>
-                  <td>
-                    <a href={`${repoUrl}/blob/master/CHANGELOG.md`}>
-                      Changelog
-                    </a>
-                  </td>
-                </tr>
-              ))}
+                {pastVersions.map((version) => (
+                  <tr key={version.name}>
+                    <th>{version.label}</th>
+                    <td>
+                      <Link to={version.path}>Documentation</Link>
+                    </td>
+                    <td>
+                      <a href={`${repoUrl}/blob/master/CHANGELOG.md`}>
+                        Changelog
+                      </a>
+                    </td>
+                  </tr>
+                ))}
               </tbody>
             </table>
           </div>
         )}
       </main>
     </Layout>
-  );
+  )
 }
 
-export default Version;
+export default Version
diff --git a/docs/src/plugins/analytics/analytics.js b/docs/src/plugins/analytics/analytics.js
index a88dc01af..1f1ed24ed 100644
--- a/docs/src/plugins/analytics/analytics.js
+++ b/docs/src/plugins/analytics/analytics.js
@@ -5,26 +5,25 @@
  * LICENSE file in the root directory of this source tree.
  */
 
-import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
+import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment'
 
 export default (function () {
   if (!ExecutionEnvironment.canUseDOM) {
-    return null;
+    return null
   }
 
   return {
-    onRouteUpdate({location}) {
+    onRouteUpdate({ location }) {
       if (typeof window.gtag !== 'function') {
         return
       }
 
-
       const pagePath = location
         ? location.pathname + location.search + location.hash
         : undefined
       window.gtag('config', 'UA-71865250-1', {
-        'page_path': pagePath
-      });
-    },
-  };
-})();
+        page_path: pagePath
+      })
+    }
+  }
+})()
diff --git a/docs/src/plugins/analytics/index.js b/docs/src/plugins/analytics/index.js
index 163550a3c..b40c28919 100644
--- a/docs/src/plugins/analytics/index.js
+++ b/docs/src/plugins/analytics/index.js
@@ -5,25 +5,45 @@
  * LICENSE file in the root directory of this source tree.
  */
 
-const path = require('path');
+const path = require('path')
 
 module.exports = function (context) {
   return {
     name: 'docusaurus-plugin-google-analytics',
 
     getClientModules() {
-      return [path.resolve(__dirname, './analytics')];
+      return [path.resolve(__dirname, './analytics')]
     },
 
     injectHtmlTags() {
       return {
         headTags: [
+          {
+            tagName: 'script',
+            innerHTML: `
+window.dataLayer = window.dataLayer || [];
+function gtag(){dataLayer.push(arguments);}
+
+gtag('consent', 'default', {
+  'analytics_storage': 'allowed',
+  'ad_storage': 'denied',
+  'ads_data_redaction': true
+});
+
+gtag('consent', 'default', {
+  'ad_storage': 'denied',
+  'analytics_storage': 'denied',
+  'ads_data_redaction': true,
+  'region': ['BE','BG','CZ','DK','DE','EE','IE','EL','ES','FR','HR','IT','CY','LV','LT','LU','HU','MT','NL','AT','PL','PT','RO','SI','SK','FI','SE','US-CA']
+});
+            `
+          },
           {
             tagName: 'script',
             attributes: {
-              rel: 'preconnect',
-              src: 'https://www.googletagmanager.com/gtag/js?id=G-9ZKQ6W782H',
-            },
+              async: true,
+              src: 'https://www.googletagmanager.com/gtag/js?id=UA-71865250-1'
+            }
           },
           {
             tagName: 'script',
@@ -32,18 +52,12 @@ window.dataLayer = window.dataLayer || [];
 function gtag(){dataLayer.push(arguments);}
 gtag('js', new Date());
 
-gtag('config', 'UA-71865250-1');
-gtag('config', 'GA_TRACKING_ID', { 'anonymize_ip': true });
+gtag('config', 'G-J01VQCC9Y9'); // automatically anonymized
 gtag('config', 'UA-71865250-1', { 'anonymize_ip': true });
-gtag('consent', 'default', {
-  'ad_storage': 'denied',
-  'analytics_storage': 'denied',
-  'ads_data_redaction': true
-});
-            `,
+            `
           }
-        ],
-      };
-    },
-  };
-};
+        ]
+      }
+    }
+  }
+}
diff --git a/docs/src/theme/CodeFromRemote.js b/docs/src/theme/CodeFromRemote.js
index be3bb03ba..e24b3e127 100644
--- a/docs/src/theme/CodeFromRemote.js
+++ b/docs/src/theme/CodeFromRemote.js
@@ -29,7 +29,10 @@ const detectLanguage = (src) => {
 }
 
 const findPath = (src) => {
-  const matches = src.match(new RegExp('https://github.com/[^/]+/[^/]+/blob/[^/]+/(.+)', 'i')) || []
+  const matches =
+    src.match(
+      new RegExp('https://github.com/[^/]+/[^/]+/blob/[^/]+/(.+)', 'i')
+    ) || []
   if (matches.length >= 2) {
     return matches[1]
   }
@@ -50,9 +53,7 @@ const findLine = (needle, haystack) => {
   return index
 }
 
-const transform = (
-  { startAt, endAt }
-) => (content) => {
+const transform = ({ startAt, endAt }) => (content) => {
   let lines = content.split('\n')
 
   const startIndex = findLine(startAt, lines)
@@ -62,7 +63,7 @@ const transform = (
 
   const endIndex = findLine(endAt, lines)
   if (endIndex > 0) {
-    lines = [...lines.slice(0, endIndex+1), '// ...']
+    lines = [...lines.slice(0, endIndex + 1), '// ...']
   }
 
   return lines.join('\n')
@@ -76,7 +77,8 @@ const CodeFromRemote = (props) => {
     fetch(
       src
         .replace('github.com', 'raw.githubusercontent.com')
-        .replace('/blob/', '/'))
+        .replace('/blob/', '/')
+    )
       .then((body) => body.text())
       .then(transform(props))
       .then(setContent)
@@ -88,7 +90,7 @@ const CodeFromRemote = (props) => {
 
   return (
     <div className={styles.container}>
-      <CodeBlock metastring={title} className={lang} children={content}/>
+      <CodeBlock metastring={title} className={lang} children={content} />
     </div>
   )
 }
diff --git a/docs/src/theme/CodeFromRemote.module.css b/docs/src/theme/CodeFromRemote.module.css
index 87e8c19b4..c3c038838 100644
--- a/docs/src/theme/CodeFromRemote.module.css
+++ b/docs/src/theme/CodeFromRemote.module.css
@@ -1,3 +1,3 @@
 .container {
-  margin-bottom: var(--ifm-leading)
+  margin-bottom: var(--ifm-leading);
 }
diff --git a/docs/src/theme/Footer/index.js b/docs/src/theme/Footer/index.js
index 59fab5453..f8ffeb47a 100644
--- a/docs/src/theme/Footer/index.js
+++ b/docs/src/theme/Footer/index.js
@@ -4,18 +4,18 @@
  * This source code is licensed under the MIT license found in the
  * LICENSE file in the root directory of this source tree.
  */
-import React from 'react';
-import clsx from 'clsx';
-import Link from '@docusaurus/Link';
-import {useThemeConfig} from '@docusaurus/theme-common';
-import useBaseUrl from '@docusaurus/useBaseUrl';
-import styles from './styles.module.css';
+import React from 'react'
+import clsx from 'clsx'
+import Link from '@docusaurus/Link'
+import { useThemeConfig } from '@docusaurus/theme-common'
+import useBaseUrl from '@docusaurus/useBaseUrl'
+import styles from './styles.module.css'
 
-function FooterLink({to, href, label, prependBaseUrlToHref, ...props}) {
-  const toUrl = useBaseUrl(to);
+function FooterLink({ to, href, label, prependBaseUrlToHref, ...props }) {
+  const toUrl = useBaseUrl(to)
   const normalizedHref = useBaseUrl(href, {
-    forcePrependBaseUrl: true,
-  });
+    forcePrependBaseUrl: true
+  })
   return (
     <Link
       className="footer__link-item"
@@ -23,35 +23,37 @@ function FooterLink({to, href, label, prependBaseUrlToHref, ...props}) {
         ? {
             target: '_blank',
             rel: 'noopener noreferrer',
-            href: prependBaseUrlToHref ? normalizedHref : href,
+            href: prependBaseUrlToHref ? normalizedHref : href
           }
         : {
-            to: toUrl,
+            to: toUrl
           })}
-      {...props}>
+      {...props}
+    >
       {label}
     </Link>
-  );
+  )
 }
 
-const FooterLogo = ({url, alt}) => (
+const FooterLogo = ({ url, alt }) => (
   <img className="footer__logo" alt={alt} src={url} />
-);
+)
 
 function Footer() {
-  const {footer} = useThemeConfig();
-  const {copyright, links = [], logo = {}} = footer || {};
-  const logoUrl = useBaseUrl(logo.src);
+  const { footer } = useThemeConfig()
+  const { copyright, links = [], logo = {} } = footer || {}
+  const logoUrl = useBaseUrl(logo.src)
 
   if (!footer) {
-    return null;
+    return null
   }
 
   return (
     <footer
       className={clsx('footer', {
-        'footer--dark': footer.style === 'dark',
-      })}>
+        'footer--dark': footer.style === 'dark'
+      })}
+    >
       <div className="container">
         {links && links.length > 0 && (
           <div className="row footer__links">
@@ -71,14 +73,14 @@ function Footer() {
                           className="footer__item" // Developer provided the HTML, so assume it's safe.
                           // eslint-disable-next-line react/no-danger
                           dangerouslySetInnerHTML={{
-                            __html: item.html,
+                            __html: item.html
                           }}
                         />
                       ) : (
                         <li key={item.href || item.to} className="footer__item">
                           <FooterLink {...item} />
                         </li>
-                      ),
+                      )
                     )}
                   </ul>
                 ) : null}
@@ -95,7 +97,8 @@ function Footer() {
                     href={logo.href}
                     target="_blank"
                     rel="noopener noreferrer"
-                    className={styles.footerLogoLink}>
+                    className={styles.footerLogoLink}
+                  >
                     <FooterLogo alt={logo.alt} url={logoUrl} />
                   </a>
                 ) : (
@@ -107,14 +110,14 @@ function Footer() {
             <div // Developer provided the HTML, so assume it's safe.
               // eslint-disable-next-line react/no-danger
               dangerouslySetInnerHTML={{
-                __html: copyright,
+                __html: copyright
               }}
             />
           </div>
         )}
       </div>
     </footer>
-  );
+  )
 }
 
-export default Footer;
+export default Footer
diff --git a/docs/src/theme/Mermaid.js b/docs/src/theme/Mermaid.js
index 3978361bb..f237456e5 100644
--- a/docs/src/theme/Mermaid.js
+++ b/docs/src/theme/Mermaid.js
@@ -9,9 +9,9 @@
 //     cr([Create Request]) --> backoffice[Backoffice Server REST]
 // `}/>
 
-import React, {useEffect, useState} from "react"
-import mermaid from "mermaid"
-import styles from './mermaid.module.css';
+import React, { useEffect, useState } from 'react'
+import mermaid from 'mermaid'
+import styles from './mermaid.module.css'
 import cn from 'classnames'
 
 mermaid.initialize({
@@ -19,42 +19,52 @@ mermaid.initialize({
   logLevel: 'fatal',
   securityLevel: 'strict',
   arrowMarkerAbsolute: false,
-  theme: "neutral",
+  theme: 'neutral',
   flowchart: {
     useMaxWidth: true,
     htmlLabels: true,
     rankSpacing: 65,
     nodeSpacing: 30,
-    curve: "basis"
+    curve: 'basis'
   },
   sequence: {
-    useMaxWidth: true,
+    useMaxWidth: true
   },
   gantt: {
-    useMaxWidth: true,
+    useMaxWidth: true
   }
 })
 
-const Mermaid = ({chart}) => {
-  const [zoomed, setZoomed] = useState(false);
+const Mermaid = ({ chart }) => {
+  const [zoomed, setZoomed] = useState(false)
   const [svg, setSvg] = useState(undefined)
   const [id] = useState(`mermaid-${Math.random().toString(36).substr(2, -1)}`)
   const toggle = () => setZoomed(!zoomed)
 
   useEffect(() => {
-    mermaid.render(id, chart, (svg => {
+    mermaid.render(id, chart, (svg) => {
       setSvg(svg)
-    }))
+    })
   }, [])
 
   return (
     <>
-      <div onClick={toggle} className={cn(styles.graph, styles.pointer)} dangerouslySetInnerHTML={{__html: svg}}/>
-      <div onClick={toggle}
-           className={cn(styles.overlay, styles.pointer, styles.graph, {[styles.visible]: zoomed})}>
-        <div onClick={(e) => e.stopPropagation()}
-             className={cn(styles.backdrop, styles.graph)}
-             dangerouslySetInnerHTML={{__html: svg}}/>
+      <div
+        onClick={toggle}
+        className={cn(styles.graph, styles.pointer)}
+        dangerouslySetInnerHTML={{ __html: svg }}
+      />
+      <div
+        onClick={toggle}
+        className={cn(styles.overlay, styles.pointer, styles.graph, {
+          [styles.visible]: zoomed
+        })}
+      >
+        <div
+          onClick={(e) => e.stopPropagation()}
+          className={cn(styles.backdrop, styles.graph)}
+          dangerouslySetInnerHTML={{ __html: svg }}
+        />
       </div>
     </>
   )
diff --git a/docs/src/theme/mermaid.module.css b/docs/src/theme/mermaid.module.css
index 8ee08ed20..60118204c 100644
--- a/docs/src/theme/mermaid.module.css
+++ b/docs/src/theme/mermaid.module.css
@@ -1,5 +1,5 @@
 .graph svg {
-  max-width: 100%
+  max-width: 100%;
 }
 
 .pointer {
@@ -7,7 +7,7 @@
 }
 
 .graph {
-  margin-bottom: var(--ifm-leading)
+  margin-bottom: var(--ifm-leading);
 }
 
 .graph.overlay.visible {
@@ -21,7 +21,7 @@
   left: 0;
   right: 0;
   bottom: 0;
-  background-color: rgba(0, 0, 0, .1);
+  background-color: rgba(0, 0, 0, 0.1);
   z-index: 10000;
 }
 
diff --git a/go.mod b/go.mod
index 56067122d..7999e2bff 100644
--- a/go.mod
+++ b/go.mod
@@ -51,7 +51,6 @@ require (
 	github.com/jteeuwen/go-bindata v3.0.7+incompatible
 	github.com/julienschmidt/httprouter v1.2.0
 	github.com/leodido/go-urn v1.1.0 // indirect
-	github.com/luna-duclos/instrumentedsql/opentracing v0.0.0-20201015064105-f9d01e123f16 // indirect
 	github.com/markbates/pkger v0.17.1
 	github.com/mattn/goveralls v0.0.5
 	github.com/mikefarah/yq v1.15.0
@@ -69,7 +68,7 @@ require (
 	github.com/ory/mail/v3 v3.0.0
 	github.com/ory/nosurf v1.2.3
 	github.com/ory/viper v1.7.5
-	github.com/ory/x v0.0.164
+	github.com/ory/x v0.0.165
 	github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
 	github.com/pkg/errors v0.9.1
 	github.com/prometheus/client_golang v1.4.0
diff --git a/go.sum b/go.sum
index fc208a0b2..54fafc2c1 100644
--- a/go.sum
+++ b/go.sum
@@ -68,6 +68,7 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV
 github.com/armon/go-metrics v0.3.3 h1:a9F4rlj7EWWrbj7BYw8J8+x+ZZkJeqzNyRk8hdPF+ro=
 github.com/armon/go-metrics v0.3.3/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
 github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
+github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI=
 github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
 github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf h1:eg0MeVzsP1G42dRafH3vf+al2vQIJU0YHX+1Tw87oco=
 github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
@@ -144,6 +145,7 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng
 github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
 github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
 github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
+github.com/cucumber/godog v0.8.1 h1:lVb+X41I4YDreE+ibZ50bdXmySxgRviYFgKY6Aw4XE8=
 github.com/cucumber/godog v0.8.1/go.mod h1:vSh3r/lM+psC1BPXvdkSEuNjmXfpVqrMGYAElF6hxnA=
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@@ -171,7 +173,9 @@ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25Kn
 github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
 github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
 github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
+github.com/elastic/go-sysinfo v1.1.1 h1:ZVlaLDyhVkDfjwPGU55CQRCRolNpc7P0BbyhhQZQmMI=
 github.com/elastic/go-sysinfo v1.1.1/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0=
+github.com/elastic/go-windows v1.0.0 h1:qLURgZFkkrYyTTkvYpsZIgf83AUsdIHfvlJaqaZ7aSY=
 github.com/elastic/go-windows v1.0.0/go.mod h1:TsU0Nrp7/y3+VwE82FoZF8gC/XFg/Elz6CcloAxnPgU=
 github.com/elazarl/goproxy v0.0.0-20181003060214-f58a169a71a5/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
 github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
@@ -840,6 +844,7 @@ github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht
 github.com/jmoiron/sqlx v0.0.0-20180614180643-0dae4fefe7c0/go.mod h1:IiEW3SEiiErVyFdH8NTuWjSifiEQKUoyK3LNqr2kCHU=
 github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA=
 github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
+github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 h1:rp+c0RAYOWj8l6qbCUTSiRLG/iKnW3K3/QfPPuSsBt4=
 github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901/go.mod h1:Z86h9688Y0wesXCyonoVr47MasHilkuLMqGhRZ4Hpak=
 github.com/joho/godotenv v1.2.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
 github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
@@ -910,8 +915,8 @@ github.com/luna-duclos/instrumentedsql v1.1.2 h1:AZdd9TU/kFArfxF0Wi8PLNzniBUgo/c
 github.com/luna-duclos/instrumentedsql v1.1.2/go.mod h1:4LGbEqDnopzNAiyxPPDXhLspyunZxgPTMJBKtC6U0BQ=
 github.com/luna-duclos/instrumentedsql v1.1.3 h1:t7mvC0z1jUt5A0UQ6I/0H31ryymuQRnJcWCiqV3lSAA=
 github.com/luna-duclos/instrumentedsql v1.1.3/go.mod h1:9J1njvFds+zN7y85EDhN9XNQLANWwZt2ULeIC8yMNYs=
-github.com/luna-duclos/instrumentedsql/opentracing v0.0.0-20201015064105-f9d01e123f16 h1:NHt31cVVNEP2nBJ2naM0BIl0y6wolONdoPXYXTUNpEQ=
-github.com/luna-duclos/instrumentedsql/opentracing v0.0.0-20201015064105-f9d01e123f16/go.mod h1:YnZVBK+MxEr2sn1rbf4UMqsBd0uKaCOq52UtmbfDKNM=
+github.com/luna-duclos/instrumentedsql/opentracing v0.0.0-20201103091713-40d03108b6f4 h1:b8Uu5JfweuhcXIqANFs9dOw5zanFj89GYOGlyys37ds=
+github.com/luna-duclos/instrumentedsql/opentracing v0.0.0-20201103091713-40d03108b6f4/go.mod h1:YnZVBK+MxEr2sn1rbf4UMqsBd0uKaCOq52UtmbfDKNM=
 github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
 github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
 github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4=
@@ -1111,10 +1116,8 @@ github.com/ory/x v0.0.127 h1:goEspwhiKRoKRMBb6T6nDiv5L2mMU4EQUGwu90WM+Ao=
 github.com/ory/x v0.0.127/go.mod h1:FwUujfFuCj5d+xgLn4fGMYPnzriR5bdAIulFXMtnK0M=
 github.com/ory/x v0.0.148 h1:LLTGOS0gVcNgqFN1Nmq5CgfJEwhI8wnvDhpKXMreCWE=
 github.com/ory/x v0.0.148/go.mod h1:kYT14ajKGfDV8pRPRzQD3begYqRISZq1IQUgOVliQCE=
-github.com/ory/x v0.0.160 h1:tw1y6jowJuQEX7Rjjd5KGYzpOwdUqO41Q2MZThAW500=
-github.com/ory/x v0.0.160/go.mod h1:mus/BnwbF0EzobY8uP3tsCB+1zNgDMH1yQmfGI/oN3E=
-github.com/ory/x v0.0.164 h1:5wQHAfow9opVXfCdU6KjOngYz1eeVHnjwe/jV0P8kEI=
-github.com/ory/x v0.0.164/go.mod h1:sj3z/MeCrAyNFFTfN6yK1nTmHXGSFnw+QwIIQ/Rowec=
+github.com/ory/x v0.0.165 h1:PdLzbWj95+1hIkclBVeOchzIv3n/wSYJqRHQeEWueWA=
+github.com/ory/x v0.0.165/go.mod h1:OmHWAMal8+FhNJgDh1KkN8ik24ubjPSJQNdnTj6tzCQ=
 github.com/parnurzeal/gorequest v0.2.15/go.mod h1:3Kh2QUMJoqw3icWAecsyzkpY7UzRfDhbRdTjtNwNiUE=
 github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
 github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
@@ -1193,6 +1196,7 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR
 github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
 github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
 github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
+github.com/santhosh-tekuri/jsonschema v1.2.4 h1:hNhW8e7t+H1vgY+1QeEQpveR6D4+OwKPXCfD2aieJis=
 github.com/santhosh-tekuri/jsonschema v1.2.4/go.mod h1:TEAUOeZSmIxTTuHatJzrvARHiuO9LYd+cIxzgEHCQI4=
 github.com/santhosh-tekuri/jsonschema/v2 v2.1.0 h1:7KOtBzox6l1PbyZCuQfo923yIBpoMtGCDOD78P9lv9g=
 github.com/santhosh-tekuri/jsonschema/v2 v2.1.0/go.mod h1:yzJzKUGV4RbWqWIBBP4wSOBqavX5saE02yirLS0OTyg=
@@ -1349,9 +1353,13 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
 github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
 github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs=
 github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
+go.elastic.co/apm v1.8.0 h1:AWEKpHwRal0yCMd4K8Oxy1HAa7xid+xq1yy+XjgoVU0=
 go.elastic.co/apm v1.8.0/go.mod h1:tCw6CkOJgkWnzEthFN9HUP1uL3Gjc/Ur6m7gRPLaoH0=
+go.elastic.co/apm/module/apmhttp v1.8.0 h1:5AJPefWJzWDLX/47XIDfaloGiYWkkOQEULvlrI6Ieaw=
 go.elastic.co/apm/module/apmhttp v1.8.0/go.mod h1:9LPFlEON51/lRbnWDfqAWErihIiAFDUMfMV27YjoWQ8=
+go.elastic.co/apm/module/apmot v1.8.0 h1:7r8b5RGDN5gAUG7FoegzJ24+jFSZF7FvY2ODODaKFYk=
 go.elastic.co/apm/module/apmot v1.8.0/go.mod h1:Q5Xzabte8G/fkvDjr1jlDuOSUt9hkVWNZEHh6ZNaTjI=
+go.elastic.co/fastjson v1.0.0 h1:ooXV/ABvf+tBul26jcVViPT3sBir0PvXgibYB1IQQzg=
 go.elastic.co/fastjson v1.0.0/go.mod h1:PmeUOMMtLHQr9ZS9J9owrAVg0FkaZDRZJEFTTGHtchs=
 go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
 go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
@@ -1791,6 +1799,7 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh
 honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
+howett.net/plist v0.0.0-20181124034731-591f970eefbb h1:jhnBjNi9UFpfpl8YZhA9CrOqpnJdvzuiHsl/dnxl11M=
 howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0=
 modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
 modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
diff --git a/persistence/sql/persister.go b/persistence/sql/persister.go
index 239d4a824..e7e1db4b0 100644
--- a/persistence/sql/persister.go
+++ b/persistence/sql/persister.go
@@ -4,6 +4,8 @@ import (
 	"context"
 	"io"
 
+	"github.com/ory/x/pkgerx"
+
 	"github.com/gobuffalo/pop/v5"
 	"github.com/markbates/pkger"
 	"github.com/pkg/errors"
@@ -27,7 +29,7 @@ type (
 	}
 	Persister struct {
 		c        *pop.Connection
-		mb       x.MigrationPkger
+		mb       *pkgerx.MigrationBox
 		r        persisterDependencies
 		cf       configuration.Provider
 		isSQLite bool
@@ -35,9 +37,9 @@ type (
 )
 
 func NewPersister(r persisterDependencies, conf configuration.Provider, c *pop.Connection) (*Persister, error) {
-	m, err := x.NewPkgerMigration(migrations, c, r)
+	m, err := pkgerx.NewMigrationBox(migrations, c, r.Logger())
 	if err != nil {
-		return nil, errors.WithStack(err)
+		return nil, err
 	}
 
 	return &Persister{c: c, mb: m, cf: conf, r: r, isSQLite: c.Dialect.Name() == "sqlite3"}, nil
diff --git a/x/migration_box.go b/x/migration_box.go
deleted file mode 100644
index 0f7b740ea..000000000
--- a/x/migration_box.go
+++ /dev/null
@@ -1,102 +0,0 @@
-package x
-
-import (
-	"bytes"
-	"io"
-	"io/ioutil"
-	"os"
-	"strings"
-
-	"github.com/gobuffalo/pop/v5"
-	"github.com/markbates/pkger"
-	"github.com/pkg/errors"
-)
-
-// MigrationPkger is a wrapper around pkger.Dir and Migrator.
-// This will allow you to run migrations from migrations packed
-// inside of a compiled binary.
-type MigrationPkger struct {
-	pop.Migrator
-	Dir pkger.Dir
-	r   LoggingProvider
-}
-
-// NewPkgerMigration from a packr.Box and a Connection.
-//
-//	migrations, err := NewPkgerMigration(pkger.Dir("/migrations"))
-//
-func NewPkgerMigration(dir pkger.Dir, c *pop.Connection, r LoggingProvider) (MigrationPkger, error) {
-	fm := MigrationPkger{
-		Migrator: pop.NewMigrator(c),
-		Dir:      dir,
-		r:        r,
-	}
-
-	runner := func(f io.Reader) func(mf pop.Migration, tx *pop.Connection) error {
-		return func(mf pop.Migration, tx *pop.Connection) error {
-			content, err := pop.MigrationContent(mf, tx, f, true)
-			if err != nil {
-				return errors.Wrapf(err, "error processing %s", mf.Path)
-			}
-			if content == "" {
-				return nil
-			}
-			err = tx.RawQuery(content).Exec()
-			if err != nil {
-				return errors.Wrapf(err, "error executing %s, sql: %s", mf.Path, content)
-			}
-			return nil
-		}
-	}
-
-	err := fm.findMigrations(runner)
-	if err != nil {
-		return fm, err
-	}
-
-	return fm, nil
-}
-
-func (fm *MigrationPkger) findMigrations(runner func(f io.Reader) func(mf pop.Migration, tx *pop.Connection) error) error {
-	return pkger.Walk(string(fm.Dir), func(p string, info os.FileInfo, err error) error {
-		if err != nil {
-			return err
-		}
-
-		match, err := pop.ParseMigrationFilename(info.Name())
-		if err != nil {
-			if strings.HasPrefix(err.Error(), "unsupported dialect") {
-				fm.r.Logger().Debugf("Ignoring migration file because dialect is not supported: %s", err.Error())
-				return nil
-			}
-			return err
-		}
-
-		if match == nil {
-			return nil
-		}
-
-		file, err := pkger.Open(p)
-		if err != nil {
-			return err
-		}
-		defer file.Close()
-
-		content, err := ioutil.ReadAll(file)
-		if err != nil {
-			return err
-		}
-
-		mf := pop.Migration{
-			Path:      p,
-			Version:   match.Version,
-			Name:      match.Name,
-			DBType:    match.DBType,
-			Direction: match.Direction,
-			Type:      match.Type,
-			Runner:    runner(bytes.NewReader(content)),
-		}
-		fm.Migrations[mf.Direction] = append(fm.Migrations[mf.Direction], mf)
-		return nil
-	})
-}


Test patch:
diff --git a/persistence/sql/persister_hmac_test.go b/persistence/sql/persister_hmac_test.go
index afe7f8b5a..a76f5c040 100644
--- a/persistence/sql/persister_hmac_test.go
+++ b/persistence/sql/persister_hmac_test.go
@@ -3,6 +3,9 @@ package sql
 import (
 	"testing"
 
+	"github.com/ory/kratos/identity"
+	"github.com/ory/kratos/schema"
+
 	"github.com/gobuffalo/pop/v5"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
@@ -13,11 +16,36 @@ import (
 	"github.com/ory/kratos/driver/configuration"
 )
 
+type logRegistryOnly struct {
+	l *logrusx.Logger
+}
+
+func (l *logRegistryOnly) IdentityTraitsSchemas() schema.Schemas {
+	panic("implement me")
+}
+
+func (l *logRegistryOnly) IdentityValidator() *identity.Validator {
+	panic("implement me")
+}
+
+func (l *logRegistryOnly) Logger() *logrusx.Logger {
+	if l.l == nil {
+		l.l = logrusx.New("kratos", "testing")
+	}
+	return l.l
+}
+
+func (l *logRegistryOnly) Audit() *logrusx.Logger {
+	panic("implement me")
+}
+
+var _ persisterDependencies = &logRegistryOnly{}
+
 func TestPersisterHMAC(t *testing.T) {
 	viper.Set(configuration.ViperKeySecretsDefault, []string{"foobarbaz"})
 	c, err := pop.NewConnection(&pop.ConnectionDetails{URL: "sqlite://foo?mode=memory"})
 	require.NoError(t, err)
-	p, err := NewPersister(nil, configuration.NewViperProvider(logrusx.New("", ""), false), c)
+	p, err := NewPersister(&logRegistryOnly{}, configuration.NewViperProvider(logrusx.New("", ""), false), c)
 	require.NoError(t, err)
 
 	assert.True(t, p.hmacConstantCompare("hashme", p.hmacValue("hashme")))