Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

htaccess.json file whitespace issues #14

Open
ronaldtse opened this issue Feb 28, 2020 · 0 comments
Open

htaccess.json file whitespace issues #14

ronaldtse opened this issue Feb 28, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@ronaldtse
Copy link
Contributor

A normal htaccess file looks like this:

user1:ajdkahsdakdjshakd
user2:akjshdkasjdhadkjsh

In the htaccess.json read by the Lambda function, it needs to look like this:

{
  "htpasswd": "foobar:$2y$05$1h9cwwFusLcZCIUpdM7Gke.ei1E2QV6ORH/ZmvbR4h2tDGHb7q8lW\nzeebaa:$2y$05$aWBOi47GEOOoNB/ZUgdPY.NukDalyc.Bvn.S0aOlKDD9wp0R9mQHm",
...
}

But in the JSON, this will fail:

{
  "htpasswd": "foobar:$2y$05$1h9cwwFusLcZCIUpdM7Gke.ei1E2QV6ORH/ZmvbR4h2tDGHb7q8lW
zeebaa:$2y$05$aWBOi47GEOOoNB/ZUgdPY.NukDalyc.Bvn.S0aOlKDD9wp0R9mQHm",
...
}

Originally I wanted to do this:

{
  "htpasswd": "${file("htaccess")}",
...
}

But this problem prevents a direct substitution of the htaccess text and the JSON. The workaround is:

{
  "htpasswd": "${replace(file("htaccess"),"\n","\\n")}",
...
}

Can we make the function less whitespace-fussy by allowing linebreaks in addition to \n?

@ronaldtse ronaldtse added the enhancement New feature or request label Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants