simonw / datasette-publish-fly

Datasette plugin for publishing data using Fly
Apache License 2.0
20 stars 7 forks source link

Parameter --plugin-secret is not working #29

Closed fndiri closed 11 months ago

fndiri commented 11 months ago

Deploying an app with

datasette publish fly \
    data.db \
    --app my-app

works and I can access the data.

But using the script with --install ... and --plugin-secret ... flags, e.g.

datasette publish fly \
   data.db \
   --app my-app \
   --install datasette-auth-passwords \
   --plugin-secret datasette-auth-passwords root_password_hash 'pbkdf2_sha2 ...'

this error shows up:

./start-fly.sh                                                                                                ─╯
Error: Error calling 'flyctl secrets set':

Error: unknown flag: --json

Is there a change in the flyctl secret ... command?

cadeef commented 11 months ago

Looks like flyctl lost the available-everywhere --json flag a few months ago. Only secrets list supports --json now.

https://github.com/superfly/flyctl/commit/522b93af07a7f7b779999d869c55d113df171f24#diff-c60e203368cdadf078635ba44b859348b32a7e9dcab4083bcea5c24097995eec

The plugin doesn't parse output from the flyctl secrets set as JSON, so so removing --json from secrets_args.extend should fix it.

fndiri commented 11 months ago

Thanks for the clarification. I removed the --json flag in secrets_args.extend (in a local clone of the plugin) in __init__.py from

secrets_args.extend(["-a", app, "--json"]) to secrets_args.extend(["-a", app]) and it works :-).

@simonw : Will you change it in the main-branch?

BTW: Getting a better understanding of datasette and the plugin-system: Its really a great product!

simonw commented 11 months ago

Testing this with:

datasette publish fly \                                                
   fixtures.db \
   --app datasette-publish-fly-issue-29 \
   --install datasette-auth-passwords \
   --plugin-secret datasette-auth-passwords root_password_hash 'pbkdf2_sha256$480000$9ce99372d1fa079f770d4e2245bcf335$zJjskTDc6M8sxmEUYZBr/EC0e730Q9pzcF8RJB43c/c='

(That's a password of "password").

That worked: https://datasette-publish-fly-issue-29.fly.dev/