#Help linking my bot to the planet scale db

1 messages ยท Page 1 of 1 (latest)

rare shell
#

I'm really needing help to get this done by the second please ๐Ÿ™
@craggy nebula

craggy nebula
#

Do you have a GH repo that you can share?

rare shell
#

Oh ok github. I don't think I do

craggy nebula
#

What have you tried so far?

rare shell
#

I've just read up on how I should go about moving it and gotten super confused and frustrated

craggy nebula
#

What programming language are you using for your bot? And what are you trying to achieve with it?

rare shell
rare shell
#

I don't have the needed in depth understanding of how code speaks to my bot to tell it what to do

#

I can understand the very basics like calling a dep that tells the bot to "do this" or "retrieve that" but that's about as deep as it goes

craggy nebula
#

ok, so there is some ground to cover if you want to get this working. First, have you found any documentation on how to connect your bot to a database AND which database is recommended?

rare shell
craggy nebula
#

It's technically a hosted DB. However it looks like autocode is more or less a hosting server, and you could connect to planetscale with a DB connector and the connection string Planetscale would provide. DO NOT hardcode that connection string though, you need to use secrets and environment variables to keep it secure.

rare shell
craggy nebula
#

Planetscale can host your data. Autocode is hosting our bot.

rare shell
rare shell
craggy nebula
#

hard coding means putting the connection string directly in the javascript code.

rare shell
craggy nebula
#

yes

rare shell
#

Ah, yeah I don't want that then

craggy nebula
#

That is how you would do it. ??

rare shell
#

Oh. So I could still use secrets and env ver ?

craggy nebula
#

yeah, you get your connection string from Planetscale, and that will go in the .env file. Then inside the bot you use the secrets API to access that connection string. That makes the string a) secure - the app only sees it when it's running, and b) flexible - you can change the connection string in .env at any time, restart the app, and it's pointed to a new database or using an updated password, etc. --- WITHOUT having to change any application code.

#

If you aren't familiar with this, I highly recommend getting acquainted with the concepts behind all of this. It will give you a foundation to understand exactly what's going one.

rare shell
#

And everything after that just scrambled my eggs

craggy nebula
#

AND it's not helpful.

rare shell
#

Nah, that wasn't helpful lol. I appreciate your help but this is just getting me more and more confused and I feel like I'm starting to be a nuisance so I'll just lay it down for now and eventually I'll get it figured out. I'm sorry for wasting your time but I did get one step closer by confirming that I will want to use that string to do what I'm trying to do. ๐Ÿ™๐Ÿ™