question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Keyword Mappings of limited value to HTML content

See original GitHub issue

Scenario

  • You use the deploy-cli to deploy your custom logon page
  • Your project promotes changes through a series of environments before getting to productioin
  • Each environment has a different CDN for hosting css, images, scripts, etc

Ideally, in this scenario you’d want to be able to build your page to accept a Keyword Mapping to replace the CDN host address during deployment.

Something like this:

<html>
    <head>
   <script src="@@CDN_HOST@@/snazzy-login.js"></script>
   <link href="@@CDN_HOST@@/styles/login.css" rel="stylesheet" type="text/css"/>
    </head>
    <body>
      <h1> Logon! </h1>
      <img src="@@CDN_HOST@@/images/company_logo.png" />
    </body>
</html>

With a config file like this:

{
  "AUTH0_DOMAIN": "...",
  "AUTH0_CLIENT_ID": "...",
  "AUTH0_CLIENT_SECRET": "...",
  "AUTH0_KEYWORD_REPLACE_MAPPINGS": {
    "CDN_HOST": "https://prod.cdn.com"
  }
}

Unfortunately this yields extra " in the HTML when deployed eg:

href=““https://prod.cdn.com”/styles/login.css”

I assume this is because the mapping was originally written for building JSON trees like

{
  "host": @@CDN_HOST@@
}

My local testing is consistent, I’m surprised this didn’t come up in #3 when @nickcoury was trying something similar?

I’m trying to replace a keyword in an HTML page and for the life of me can’t get it to work as the documentation shows.

Am I imagining things?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mostekcmcommented, Jun 27, 2017

@GavinOsborn love that last idea! See this PR: https://github.com/auth0-extensions/auth0-source-control-extension-tools/pull/17

I’ve changed it to just support @@key@@ => JSON replace, ##key## => Literal replace

0reactions
GavinOsborncommented, Sep 22, 2017

Just shipped our adoption of this feature. Works a treat! Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Keyword type family | Elasticsearch Guide [8.5]
The wildcard type is optimized for fields with large values or high cardinality. Mapping unstructured content. You can map a field containing unstructured ......
Read more >
Keyword Mapping for SEO: 7-Step Guide for Your Website
Keyword mapping is a must-do thing for any SEO or website owner, as it can help you refine your content strategy in the...
Read more >
Elasticsearch Mapping: The Basics, Updates & Examples
Keyword fields are only searchable by their exact value. Use keyword data types when you have fields like email addresses, hostnames, status codes,...
Read more >
HTML attribute reference - HTML: HyperText Markup Language
Attribute Name Elements Description accept‑charset List of supported charsets. align, , , , , , , , , , , , , Specifies the horizontal...
Read more >
Autocomplete attribute has valid value | ACT Rule | WAI
This rule checks that the HTML autocomplete attribute has a correct value. ... value of either Image Button (the state) or image (the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found