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/plausible
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
..
auth Handle duplicate invitations gracefully (#2323) 4 years ago
billing Enable Dialyzer and Credo in CI (#2315) 4 years ago
event Crm transfer data (#1749) 5 years ago
goal Trim goals when creating and retrieving from the DB (#2382) 4 years ago
google Fix and test Google Analytics token refresh (#2381) 4 years ago
helpers Trim the value in case it contains newlines (#2480) 4 years ago
imported Skip rows with empty dates from GA imports (#2359) 4 years ago
ingestion Fix: application startup, event timestamps (#2479) 4 years ago
sentry Use finch in sentry client (#1996) 4 years ago
session Use new Session.CacheStore in favour of Session.Store (#1934) 5 years ago
site Fix: application startup, event timestamps (#2479) 4 years ago
stats Add support for intervals (#1574) 4 years ago
telemetry Gatekeep ingestion pipeline (#2472) 4 years ago
application.ex Fix: application startup, event timestamps (#2479) 4 years ago
clickhouse_repo.ex Delete stats improvements (#2318) 4 years ago
goals.ex Improve test coverage (#2392) 4 years ago
http_client.ex Trace external HTTP requests (#2419) 4 years ago
mailer.ex Do not report hard bounce e-mail errors to Sentry (#2361) 4 years ago
mailer_test.exs Do not report hard bounce e-mail errors to Sentry (#2361) 4 years ago
open_telemetry.ex Remove ingestion from OTEL tracing (#2409) 4 years ago
prom_ex.ex Add Custom telemetry for Plausible.Event.WriteBuffer, Plausible.Event.WriteBuffer and Cachex (#2095) 4 years ago
purge.ex Add API support for intervals (#2417) 4 years ago
repo.ex Pagination for sites listing (#994) 6 years ago
site.ex Kick off sites by domain cache implementation (#2434) 4 years ago
sites.ex Allow Site DB lookups during ingestion phase (#2408) 4 years ago
themes.ex Adds dark mode to entire dashboard (#467) 6 years ago
timezones.ex Fix timezone list when time changes (#2268) 4 years ago