<FromGitter>
<yorci> i have an issue with the granite, ⏎ ```Unhandled exception: PG::ResultSet#read returned a Int32. A (Int64 | Nil) was expected. (Exception)```
<FromGitter>
<Blacksmoke16> you're column is an `INT` while `Int64?` was set in Granite
<FromGitter>
<Blacksmoke16> PK in granite assumes `BIGINT` so thats prob your issue
<FromGitter>
<Blacksmoke16> or in case of PG `BIGSERIAL`
<FromGitter>
<Blacksmoke16> @yorci
<FromGitter>
<yorci> Well if i change the column type integer to bigint in postgresql, it returns that error : ⏎ ⏎ ``` Unhandled exception: PG::ResultSet#read returned a Int64. A (Int32 | Nil) was expected. (Exception) ```
<FromGitter>
<Blacksmoke16> can you show your model/schema?
<FromGitter>
<0x2C6> yes I know :D I moved it there just for test :D
<FromGitter>
<0x2C6> just wondering can I use it without requiring in router.cr?
<FromGitter>
<0x2C6> would it work if I upload it to github and install as a shard?
<FromGitter>
<Blacksmoke16> you shouldnt have to do that
<FromGitter>
<Blacksmoke16> should just go to your like `/config/routes.cr` and require it there, then add `pipe MyPipe.new`?
<FromGitter>
<0x2C6> yes I want to use it in that way but unless I require, it raise Undefined Constant error
<FromGitter>
<0x2C6> maybe it will work when installing it as shard
<FromGitter>
<Blacksmoke16> well yea you need to tell it that you need
<FromGitter>
<0x2C6> I'll try
<FromGitter>
<Blacksmoke16> otherwise you just have a random `my_pipe.cr` file hanging around that isnt included anywhere
<FromGitter>
<Blacksmoke16> prob could also require it at a higher level like `config/application.cr`
<FromGitter>
<0x2C6> Okay I found out that if you want to create new new pipe you should you that app/src/amber/pipe/app.cr structure. Otherwise it raise error
<FromGitter>
<Blacksmoke16> makes sense, would be similar to your `controllers` directory etc
<FromGitter>
<0x2C6> Now I will try to upload it to github and pull again as a shard and try to use it withoud requiring in routes.cr
<FromGitter>
<Blacksmoke16> pull what as a shard? a whole amber app with 1 pipe in it?
<FromGitter>
<0x2C6> just added gitrepo to shards file
<FromGitter>
<Blacksmoke16> ok
<FromGitter>
<0x2C6> you think I'm stupid. Aren't you? :D
<FromGitter>
<Blacksmoke16> it sure seems your doing a lot of work for something that would be solved by doing like `require "../src/pipes/*"`in your app's `config/application.cr`
<FromGitter>
<Blacksmoke16> granted i never actually used amber so maybe you know something i dont :P
<FromGitter>
<0x2C6> I want to keep them separated thats why I don't want to put them to src
<FromGitter>
<Blacksmoke16> why tho? if you're amber app *needs* that pipe?
<FromGitter>
<0x2C6> as a gem :D
<FromGitter>
<Blacksmoke16> alright
<FromGitter>
<0x2C6> Ok I install it as a shard but amber doesn't auto require it :(
<FromGitter>
<Blacksmoke16> unless someone else has some magic idea im not sure what else you can do, amber doesn know about the file, you need to require the file :shrug:
<FromGitter>
<0x2C6> how amber autoloads all shards?
<FromGitter>
<0x2C6> but then how it works with granite or etc?
<FromGitter>
<0x2C6> Hmmm I thing you're right
<FromGitter>
<0x2C6> all have configuration files with require line :(
<FromGitter>
<0x2C6> kinda frustrating
<FromGitter>
<Blacksmoke16> i dont see how its a big deal?
<FromGitter>
<0x2C6> anyway. Thanks you for your help :D. After all I learned something new today
<FromGitter>
<Blacksmoke16> np
<FromGitter>
<0x2C6> one last thing
<FromGitter>
<0x2C6> ;)
<FromGitter>
<0x2C6> about deployment
<FromGitter>
<0x2C6> forget about deploy command :D
<FromGitter>
<0x2C6> at the one of the old messages a man suggested me mina.js for deploy
<FromGitter>
<Blacksmoke16> im not the best to ask about that unfortunately
<FromGitter>
<0x2C6> but I just clone and compile it on the server and run it
<FromGitter>
<0x2C6> no problem maybe someone else will read it
<FromGitter>
<0x2C6> I run it at background and write the process pid to another folder. I thing it isn't a good practice
<FromGitter>
<0x2C6> Open for suggestions :D
<FromGitter>
<rmarronnier> Hey all, I'm going crazy, maybe you can help me : '''settings.database_url = ENV["DATABASE_URL"] if ENV["DATABASE_URL"]?''' is uncommented in my '''application.cr'''
<FromGitter>
<rmarronnier> And I've done '''export DATABASE_URL="test"''' in my terminal
<FromGitter>
<rmarronnier> printenv shows it
<FromGitter>
<rmarronnier> and yet when I start my application with amber watch, its picks the url from my development.yml file
<FromGitter>
<rmarronnier> I thought : # Any uncommented setting here will override the YAML with the value set here.
<FromGitter>
<rmarronnier> Do you have any pointers ?
<FromGitter>
<rmarronnier> I need the database url to be set by the env variable (I'm hosting my app on Heroku, and I don't want anymore to hardcode the URL in my .yml, because it keeps changing)
<FromGitter>
<Blacksmoke16> might have to change like amber env var to use prod config file? @rmarronnier ?
<FromGitter>
<elorest> @rmarronnier Give me a second.
<FromGitter>
<elorest> settings are definitely being loaded in correctly and overwritten by ENV vars. @Blacksmoke16 Has a change in granite been made that ignores settings and looks at the environment files directly?
<FromGitter>
<Blacksmoke16> Granite doesn't set anything on it's own
<FromGitter>
<Blacksmoke16> Only uses what you define when adding your adapter
<FromGitter>
<elorest> database.cr was changed quite a bit a couple months ago and moved from `./config/initializers` to `./config`. I'm doing a couple tests right now.
<FromGitter>
<elorest> @Blacksmoke16 @rmarronnier `./config/database.cr` is being loaded before `Amber::Server.configure` is run.
<FromGitter>
<Blacksmoke16> is that bad?
<FromGitter>
<elorest> Yes. Because the database adapter is initialized with the wrong settings.
<FromGitter>
<elorest> It's possible it's been like this for a while. I'm looking back through history. Originally settings used a macro to load which allowed them to read in env vars pre runtime. This had other disadvantages though... mostly harder to read code, so it was refactored. I feel like this wasn't an issue even after the refactor though.
<FromGitter>
<elorest> Looking through history.
<FromGitter>
<Blacksmoke16> is an amber issue then?
<FromGitter>
<elorest> @Blacksmoke16 Looks like the bug was introduced when support for Crecto was added. Something which probably needs to be removed since it's not longer maintained.
<FromGitter>
<Blacksmoke16> Crecto itself or the support for amber?
<FromGitter>
<rmarronnier> oh thanks god ! Isaac Sloan :-D
<FromGitter>
<rmarronnier> It's weird noone came across this problem before...
<FromGitter>
<rmarronnier> anyway thanks for your help