Skip to content

Commit

Permalink
chore: update repository templates
Browse files Browse the repository at this point in the history
[skip ci] - updated repository templates to ory/meta@a4c405f
  • Loading branch information
aeneasr committed Feb 2, 2022
1 parent 83cb5c0 commit da516f5
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 100 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,13 @@ that your company deserves a spot here, reach out to
<td>Sponsor</td>
<td>Strivacity</td>
<td align="center"><img height="16px" src="https://raw.githubusercontent.com/ory/meta/master/static/adopters/strivacity.svg" alt="Strivacity"></td>
<td><a href="https://strivacity.com/">strivacity</a></td>
<td><a href="https://strivacity.com/">strivacity.com</a></td>
</tr>
<tr>
<td>Adopter *</td>
<td>Hanko</td>
<td align="center"><img height="32px" src="https://raw.githubusercontent.com/ory/meta/master/static/adopters/hanko.svg" alt="Hanko"></td>
<td><a href="https://hanko.io/">hanko.io</a></td>
</tr>
</tbody>
</table>
Expand Down
14 changes: 10 additions & 4 deletions docs/docs/pipeline/authz.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,11 @@ if it returns a "403 Forbidden" response code, the access is denied.
headers on this list will be forward to upstream services.
- `retry` (object, optional) - Configures timeout and delay settings for the
request against the token endpoint
- `give_up_after` (string) max delay duration of retry. The value will be parsed by the Go [duration parser](https://pkg.go.dev/time#ParseDuration).
- `max_delay` (string) time to wait between retries and max service response time. The value will be parsed by the Go [duration parser](https://pkg.go.dev/time#ParseDuration).
- `give_up_after` (string) max delay duration of retry. The value will be
parsed by the Go [duration parser](https://pkg.go.dev/time#ParseDuration).
- `max_delay` (string) time to wait between retries and max service response
time. The value will be parsed by the Go
[duration parser](https://pkg.go.dev/time#ParseDuration).

#### Example

Expand Down Expand Up @@ -388,8 +391,11 @@ Forbidden" response code, the access is denied.
headers on this list will be forward to upstream services.
- `retry` (object, optional) - Configures timeout and delay settings for the
request against the token endpoint
- `give_up_after` (string) max delay duration of retry. The value will be parsed by the Go [duration parser](https://pkg.go.dev/time#ParseDuration).
- `max_delay` (string) time to wait between retries and max service response time. The value will be parsed by the Go [duration parser](https://pkg.go.dev/time#ParseDuration).
- `give_up_after` (string) max delay duration of retry. The value will be
parsed by the Go [duration parser](https://pkg.go.dev/time#ParseDuration).
- `max_delay` (string) time to wait between retries and max service response
time. The value will be parsed by the Go
[duration parser](https://pkg.go.dev/time#ParseDuration).

#### Example

Expand Down
156 changes: 77 additions & 79 deletions docs/scripts/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,101 +45,99 @@ if (process.argv.length !== 3 || process.argv[1] === 'help') {

const config = require(path.resolve(process.argv[2]))

const enhance =
(schema, parents = []) =>
(item) => {
const key = item.key.value

const path = [
...parents.map((parent) => ['properties', parent]),
['properties', key]
].flat()

if (['title', 'description'].find((f) => path[path.length - 1] === f)) {
return
}
const enhance = (schema, parents = []) => (item) => {
const key = item.key.value

const comments = [`# ${pathOr(key, [...path, 'title'], schema)} ##`, '']
const path = [
...parents.map((parent) => ['properties', parent]),
['properties', key]
].flat()

const description = pathOr('', [...path, 'description'], schema)
if (description) {
comments.push(' ' + description.split('\n').join('\n '), '')
}
if (['title', 'description'].find((f) => path[path.length - 1] === f)) {
return
}

const defaultValue = pathOr('', [...path, 'default'], schema)
if (defaultValue || defaultValue === false) {
comments.push(' Default value: ' + defaultValue, '')
}
const comments = [`# ${pathOr(key, [...path, 'title'], schema)} ##`, '']

const enums = pathOr('', [...path, 'enum'], schema)
if (enums && Array.isArray(enums)) {
comments.push(
' One of:',
...YAML.stringify(enums)
.split('\n')
.map((i) => ` ${i}`)
) // split always returns one empty object so no need for newline
}
const description = pathOr('', [...path, 'description'], schema)
if (description) {
comments.push(' ' + description.split('\n').join('\n '), '')
}

const min = pathOr('', [...path, 'minimum'], schema)
if (min || min === 0) {
comments.push(` Minimum value: ${min}`, '')
}
const defaultValue = pathOr('', [...path, 'default'], schema)
if (defaultValue || defaultValue === false) {
comments.push(' Default value: ' + defaultValue, '')
}

const max = pathOr('', [...path, 'maximum'], schema)
if (max || max === 0) {
comments.push(` Maximum value: ${max}`, '')
}
const enums = pathOr('', [...path, 'enum'], schema)
if (enums && Array.isArray(enums)) {
comments.push(
' One of:',
...YAML.stringify(enums)
.split('\n')
.map((i) => ` ${i}`)
) // split always returns one empty object so no need for newline
}

const examples = pathOr('', [...path, 'examples'], schema)
if (examples) {
comments.push(
' Examples:',
...YAML.stringify(examples)
.split('\n')
.map((i) => ` ${i}`)
) // split always returns one empty object so no need for newline
}
const min = pathOr('', [...path, 'minimum'], schema)
if (min || min === 0) {
comments.push(` Minimum value: ${min}`, '')
}

let hasChildren
if (item.value.items) {
item.value.items.forEach((item) => {
if (item.key) {
enhance(schema, [...parents, key])(item)
hasChildren = true
}
})
}
const max = pathOr('', [...path, 'maximum'], schema)
if (max || max === 0) {
comments.push(` Maximum value: ${max}`, '')
}

const examples = pathOr('', [...path, 'examples'], schema)
if (examples) {
comments.push(
' Examples:',
...YAML.stringify(examples)
.split('\n')
.map((i) => ` ${i}`)
) // split always returns one empty object so no need for newline
}

let hasChildren
if (item.value.items) {
item.value.items.forEach((item) => {
if (item.key) {
enhance(schema, [...parents, key])(item)
hasChildren = true
}
})
}

const showEnvVarBlockForObject = pathOr(
'',
[...path, 'showEnvVarBlockForObject'],
schema
const showEnvVarBlockForObject = pathOr(
'',
[...path, 'showEnvVarBlockForObject'],
schema
)
if (!hasChildren || showEnvVarBlockForObject) {
const env = [...parents, key].map((i) => i.toUpperCase()).join('_')
comments.push(
' Set this value using environment variables on',
' - Linux/macOS:',
` $ export ${env}=<value>`,
' - Windows Command Line (CMD):',
` > set ${env}=<value>`,
''
)
if (!hasChildren || showEnvVarBlockForObject) {
const env = [...parents, key].map((i) => i.toUpperCase()).join('_')

// Show this if the config property is an object, to call out how to specify the env var
if (hasChildren) {
comments.push(
' Set this value using environment variables on',
' - Linux/macOS:',
` $ export ${env}=<value>`,
' - Windows Command Line (CMD):',
` > set ${env}=<value>`,
' This can be set as an environment variable by supplying it as a JSON object.',
''
)

// Show this if the config property is an object, to call out how to specify the env var
if (hasChildren) {
comments.push(
' This can be set as an environment variable by supplying it as a JSON object.',
''
)
}
}

item.commentBefore = comments.join('\n')
item.spaceBefore = true
}

item.commentBefore = comments.join('\n')
item.spaceBefore = true
}

new Promise((resolve, reject) => {
parser.dereference(
require(path.resolve(config.updateConfig.src)),
Expand Down
26 changes: 12 additions & 14 deletions docs/src/theme/CodeFromRemote.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,22 @@ const findLine = (needle, haystack) => {
return index
}

const transform =
({ startAt, endAt }) =>
(content) => {
let lines = content.split('\n')
const transform = ({ startAt, endAt }) => (content) => {
let lines = content.split('\n')

const startIndex = findLine(startAt, lines)
if (startIndex > 0) {
lines = ['// ...', ...lines.slice(startIndex, -1)]
}

const endIndex = findLine(endAt, lines)
if (endIndex > 0) {
lines = [...lines.slice(0, endIndex + 1), '// ...']
}
const startIndex = findLine(startAt, lines)
if (startIndex > 0) {
lines = ['// ...', ...lines.slice(startIndex, -1)]
}

return lines.join('\n')
const endIndex = findLine(endAt, lines)
if (endIndex > 0) {
lines = [...lines.slice(0, endIndex + 1), '// ...']
}

return lines.join('\n')
}

const CodeFromRemote = (props) => {
const { src, title } = props
const [content, setContent] = useState('')
Expand Down
3 changes: 1 addition & 2 deletions docs/src/theme/ketoRelationTuplesPrism.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ export default (prism) =>
(prism.languages['keto-relation-tuples'] = {
comment: /\/\/.*(\n|$)/,
'relation-tuple': {
pattern:
/([^:#@()\n]+:)?([^:#@()\n]+)#([^:#@()\n]+)@?((\(([^:#@()\n]+:)?([^:#@()\n]+)#([^:#@()\n]*)\))|([^:#@()\n]+))/,
pattern: /([^:#@()\n]+:)?([^:#@()\n]+)#([^:#@()\n]+)@?((\(([^:#@()\n]+:)?([^:#@()\n]+)#([^:#@()\n]*)\))|([^:#@()\n]+))/,
inside: {
namespace,
object,
Expand Down

0 comments on commit da516f5

Please sign in to comment.