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 replace mappings (# / @) in configs don't support concatenating arrays

See original GitHub issue

Description

Provide a clear and concise description of the issue, including what you expected to happen.

Placeholders ##x## or @@x@@ don’t support concatenating arrays. Sometimes you would like to concatenate arrays, e.g. allowed callback URLs, logout URLs or web origins. For example having base/global allowed URLs defined, and then adding to them for all clients/applications.

config.json

{
	"AUTH0_KEYWORD_REPLACE_MAPPINGS": {
		  "GLOBAL_WEB_ORIGINS": [
			"http://local.me:8080",
			"http://localhost",
			"http://localhost:3000"
		  ]
	}
}

def/clients/A.json

Either ##:

{
    "web_origins": [
        "##GLOBAL_WEB_ORIGINS##",
        "http://a.foo.com",
        "https://a.foo.com"
    ]
}

or @@

{
    "web_origins": [
        @@GLOBAL_WEB_ORIGINS@@,
        "http://a.foo.com",
        "https://a.foo.com"
    ]
}

Expected result:

{
    "web_origins": [
        "http://local.me:8080",
        "http://localhost",
        "http://localhost:3000",
        "http://a.foo.com",
        "https://a.foo.com"
    ]
}

Actual result:

I get an error for @@ but for ## I get the following:

{
    "web_origins": [
        "http://local.me:8080,http://localhost,http://localhost:3000",
        "http://a.foo.com",
        "https://a.foo.com"
    ]
}

Environment

Please provide the following:

  • Version of this library used: 3.6.3
  • Other relevant versions (language, server software, OS, browser): Node 8.15.1, Linux Mint, Ubuntu 18.04
  • Other modules/plugins/libraries that might be involved: N/A

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:9
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
willveddcommented, Feb 8, 2022

@rodschuler Thanks for posting that workaround, seems like a tenable solution. Though it highlights areas of potential improvement for the variable replacement functionality in general.

1reaction
rodschulercommented, Jan 27, 2022

I was having the same problem but was able to get it to work by doing the following.

In the yaml file I have

web_origins: [##APP_WEB_ORIGINS##]

and then in the config file you set it up similar to the following

"AUTH0_KEYWORD_REPLACE_MAPPINGS": { "APP_WEB_ORIGINS": "'https://a.foo.com','https://b.foo.com','https://c.foo.com'", }

basically using single quotes inside the variable used to replace the value.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change mappings and settings for a data stream - Elastic
Each data stream has a matching index template. Mappings and index settings from this template are applied to new backing indices created for...
Read more >
How to Do a Mapping of Array of Strings in Elasticsearch
In Elasticsearch, there is no dedicated array type. Any field can contain zero or more values by default, however, all values in the...
Read more >
Deploy CLI Tool Environment Variables and Keyword Mappings
Learn about environmental variables and keyword mappings used by the Deploy CLI Tool for exporting tenant configurations.
Read more >
The dynamic data type - Azure Data Explorer | Microsoft Learn
An array of dynamic values, holding zero or more values with zero-based indexing. A property bag that maps unique string values to dynamic ......
Read more >
Querying arrays with complex types and nested structures
Examples in this section show how to change element's data type, locate elements within arrays, and find keywords using Athena queries.
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