You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
analytics/lib
Serafeim Papastefanos fd6ebf7598
Trim the value in case it contains newlines (#2480)
### Changes

Hello friends, I'm trying to self-host plausible on my server and have
observed that if I add a file named (for example) `secrets/LISTEN_IP` to
configure the bind IP I'll get the following error:

```
Compiling 1 file (.ex)
** (RuntimeError) Invalid LISTEN_IP '172.19.130.83
' error: :einval
    /home/serafeim/plausible/config/runtime.exs:20: (file)
```

(notice that I get the same error when configuring the DATABASE_URL or
whatever comes first)

It seems that for whatever reason the File.read! will insert a newline
at the end of the file. Notice that I have double checked the file with
vim and *it does not contain a newline at the end* or at least I don't
know *how* to make the file not have a newline at the end.

Thus I'm adding a `String.trim()` there to fix that thing; even if I am
doing something wrong and my files *do* contain a newline at the end,
adding a `String.trim()` there definite won't hurt :)

Below you'll find a checklist. For each item on the list, check one
option and delete the other.

### Tests
- [ ] Automated tests have been added
- [x] This PR does not require tests

### Changelog
- [ ] Entry has been added to changelog
- [x] This PR does not make a user-facing change

### Documentation
- [ ] [Docs](https://github.com/plausible/docs) have been updated
- [x] This change does not need a documentation update

### Dark mode
- [ ] The UI has been tested both in dark and light mode
- [x] This PR does not change the UI
4 years ago
..
mix/tasks Gatekeep ingestion pipeline (#2472) 4 years ago
plausible Trim the value in case it contains newlines (#2480) 4 years ago
plausible_web Remove intervals feature flag (#2474) 4 years ago
workers add a test and fix rendering the dashboard link 4 years ago
oban_error_reporter.ex Delete stats improvements (#2318) 4 years ago
plausible.ex Initial commit 7 years ago
plausible_release.ex improve first launch experience for self-hosters (#2357) 4 years ago
plausible_web.ex Fix dark mode for GA import 5 years ago
sentry_filter.ex Aggregate DBConnection.ConnectionError in Sentry (#2260) 4 years ago