-
Notifications
You must be signed in to change notification settings - Fork 33
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
envsubst strips content from SQL #379
Comments
hmm - looking at Lagoon itself reveals why we do it - the api-db image inherits the mariadb one I wonder if there's a less greedy way than envsubst? |
Seems if you define what you want done, it can be less greedy |
Or possibly you could introduce .sql.gz importing (similar to mariadb on dockerhub) that didnt have envar replacement *.sql.gz) echo "$0: running $f"; gunzip -c $f| mysql -u root -p${MARIADB_ROOT_PASSWORD}; echo ;; |
I think importing data (like persisted queries) is a bit out of scope for that mechanism. In lagoon we use it to bootstrap the database structure and run migrations only (see link in previous comment from @tobybellwood). Since the queries are always hard coded, we'd never run into this kind of issue (I imagine it'd be a problem for user generated content too if you were importing that?). You can get around this by moving the On the Lagoon side, we added this to facilitate non-hardcoded passwords in the lagoon images, and we use the substitutions in a migration. It would be possible for us to remove the |
Edge cases aside, stripping content is the core issue here. The script actively removes content, which it shouldn't? envsubst might not be the way. Possibly you need a script that does the substitution without removing content? Edit: I'll work around it how you have suggested, but the issue possibly still stands |
Chased this around for a while.
lagoon-images/images/mariadb/entrypoints/9999-mariadb-init.bash
Line 135 in 2589ed7
When importing SQL dump via a volume (eg in CI), any content with a $ is stripped if it doesn't have a corresponding envar.
Example of issue:
Result:
query SampleThingy(: String!)
This wreaks havoc with automated persisted GraphQL queries, and probably any other kind of wysiwyg content.
What is the purpose of requiring
envsubst
in a db import? Could be be more specific with the use and only replace defined vars?The text was updated successfully, but these errors were encountered: