faustinoaq changed the topic of #amber to: Welcome to Amber Framework community! | https://amberframework.org | Developer happiness, productivity and bare metal performance | GH: https://github.com/amberframework | Docs: https://docs.amberframework.org | Gitter: https://gitter.im/amberframework/amber | IRC Logger: https://irclog.whitequark.org/amber | Amber::Server.start
<FromGitter> <kevinelliott> ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5c33fa3382a6c30b909fa381]
<FromGitter> <kevinelliott> Any ideas what’s up? The production environment file (encrypted) looks good.
<FromGitter> <Blacksmoke16> mm if i had to vote you're missing a yaml property :p
<FromGitter> <Blacksmoke16> maybe make sure everything is there/spelled correctly?
<FromGitter> <kevinelliott> Indeed, but which? I generated a clean app and copied in and compared everything.
<FromGitter> <kevinelliott> I don’t like the error messaging.
<FromGitter> <kevinelliott> As far as I can tell, the production yaml looks totally fine. No missing values.
<FromGitter> <kevinelliott> Thanks.
<FromGitter> <kevinelliott> OK, I’d guess this is the offender then:
<FromGitter> <kevinelliott> ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5c33fbee3cf6c35a84a95eef]
<FromGitter> <Blacksmoke16> would need to add `type` and `default` i guess
<FromGitter> <Blacksmoke16> idk, im not familiar enough with amber
<FromGitter> <kevinelliott> Yeah, agreed.
<FromGitter> <kevinelliott> OK, I pulled out those settings and was good to go.
<FromGitter> <kevinelliott> Fun.
<FromGitter> <kevinelliott> ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5c33feb23cf6c35a84a96ffe]
<FromGitter> <Blacksmoke16> rip
<FromGitter> <Blacksmoke16> oops
<FromGitter> <Blacksmoke16> https://github.com/amberframework/granite/pull/315 this one
<FromGitter> <kevinelliott> Yeah
<FromGitter> <kevinelliott> I just removed the logger lines.
<FromGitter> <kevinelliott> Fingers crossed...
<FromGitter> <kevinelliott> No still has `2019-01-08T01:45:35.944299+00:00 app[web.1]: Unhandled exception: Unsupported cipher algorithm "aes-256-cbc" (ArgumentError)`
<FromGitter> <Blacksmoke16> well thats coming from crystal
<FromGitter> <kevinelliott> Well it’s Amber’s default MessageEncryptor valu
<FromGitter> <kevinelliott> ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5c3401ad82a6c30b909fca70]
<FromGitter> <Blacksmoke16> oh
<FromGitter> <kevinelliott> But I believe Heroku’s `heroku-16` stack doesn’t have the openssl-dev package, perhaps?
<FromGitter> <Blacksmoke16> prob try installing that or update the version you have maybe
<FromGitter> <kevinelliott> Yeah, I saw that. It’s just that the OS doesn’t have it.
<FromGitter> <kevinelliott> Weird that this doesn’t work out of the box.
<FromGitter> <kevinelliott> You’d think that Amber would work just fine on Heroku
<FromGitter> <Blacksmoke16> :shrug:
<FromGitter> <kevinelliott> I probably need to update the buildpack (https://github.com/amberframework/heroku-buildpack-amber)
<FromGitter> <kevinelliott> Better yet, I’ll just prepend the buildpack list with this: https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-apt
<FromGitter> <kevinelliott> And then create an Aptfile.
<FromGitter> <kevinelliott> But seems like the amber buildpack should be updated at some point.
<FromGitter> <Blacksmoke16> maybe create an issue for it? im more the granite guy :p
<FromGitter> <kevinelliott> Yeah good idea.
<FromGitter> <kevinelliott> remote: -----> Installing libssl-dev_1.0.2g-1ubuntu4.14_amd64.deb
<FromGitter> <kevinelliott> Lame. Even after installing that, still has the original issue.
<FromGitter> <Blacksmoke16> `openssl-dev` not `libssl-dev`
<FromGitter> <kevinelliott> No, it’s libssl-dev on xenial.
<FromGitter> <kevinelliott> `openssl-dev` wasn’t available.
<FromGitter> <Blacksmoke16> ah, fair enough
<FromGitter> <kevinelliott> It might just be that the packge is too old.
<FromGitter> <kevinelliott> 1) 0.2g
<FromGitter> <Blacksmoke16> Probably
<FromGitter> <kevinelliott> Jumped up to using heroku-18 stack, but now it’s missing libevent. What a mess.
<FromGitter> <kevinelliott> `libevent-dev is already the newest version (2.1.8-stable-4build1).`
<FromGitter> <kevinelliott> Yet, `bin/amber: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory`
<FromGitter> <kevinelliott> Ahh, looking for 2.0. *shakes fist*
<FromGitter> <kevinelliott> I’m not sure why it’s looking for 2.0.
<FromGitter> <kevinelliott> I had to clear the build cache. And now it finds 2.1. https://help.heroku.com/18PI5RSY/how-do-i-clear-the-build-cache
<FromGitter> <kevinelliott> Now I’m having a boot timeout when amber starts.
<FromGitter> <Blacksmoke16> what a mess :/
<FromGitter> <kevinelliott> ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5c340efe1491b27876d9961f]
<FromGitter> <kevinelliott> Yeah
<FromGitter> <kevinelliott> Progress… I set `settings.host = “0.0.0.0”`
<FromGitter> <kevinelliott> Now it starts. But it’s serving `no driver was registered for the schema "", did you maybe forget to require the database driver?`
<FromGitter> <kevinelliott> I believe this is your territory @Blacksmoke16 :)
<FromGitter> <Blacksmoke16> gotta register an adapter
<FromGitter> <kevinelliott> Yeah i have this in my initializer
<FromGitter> <kevinelliott> `Granite::Adapters << Granite::Adapter::Pg.new({name: "pg", url: Amber.settings.database_url }) ⏎ `
<FromGitter> <Blacksmoke16> `Granite::Adapters << Granite::Adapter::Pg.new({name: "eve_sde", url: "#{ENV["DATABASE_URL"]}"})`
<FromGitter> <Blacksmoke16> `Amber.settings.database_url` is returning an empty string then
<FromGitter> <kevinelliott> Oh right, yes, it would be.
<FromGitter> <kevinelliott> Let me adjust to use the env var.
<FromGitter> <kevinelliott> Actually
<FromGitter> <kevinelliott> In my `application.cr` i have ` settings.database_url = ENV["DATABASE_URL"] if ENV["DATABASE_URL"]? ⏎ `
<FromGitter> <Blacksmoke16> hmm, make sure its actually set right
<FromGitter> <Blacksmoke16> log it or something
<FromGitter> <kevinelliott> Yes, it is.
<FromGitter> <kevinelliott> ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5c3411d526d86e4d564141b2]
<FromGitter> <Blacksmoke16> make sure that line is like the first thing in the file
<FromGitter> <kevinelliott> I’m just going to explicitly use the env var in the adapter registration and see if that fixes first.
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <kevinelliott> Success!
<FromGitter> <kevinelliott> http://www.cry.st
<FromGitter> <Blacksmoke16> nice one
<FromGitter> <kevinelliott> OK, so I think ultimately it was just the `settings.host` and the env var for the PG adapter that fixed it all.
<FromGitter> <kevinelliott> Thanks for your help, btw, @Blacksmoke16
<FromGitter> <Blacksmoke16> np, glad you got it working
<FromGitter> <kevinelliott> ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5c3416c882a6c30b90a03fbe]
<FromGitter> <Blacksmoke16> rip
<FromGitter> <kevinelliott> 😢
<FromGitter> <kevinelliott> OK, this helped:
<FromGitter> <kevinelliott> But amber watch doesn’t look in .env does it?
<FromGitter> <kevinelliott> ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5c3417e926d86e4d5641650c]
<FromGitter> <kevinelliott> Hehe
<FromGitter> <kevinelliott> Resolved with:
<FromGitter> <kevinelliott> ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5c3419e24ed182787776f7bc]
<FromGitter> <Blacksmoke16> hah wel then
<FromGitter> <eliasjpr> @kevinelliott you can sent the db in application.cr
<FromGitter> <kevinelliott> Yeah, I have it in the intializer instead.
<FromGitter> <eliasjpr> kk
<FromGitter> <eliasjpr> `settings.database_url = ENV["DATABASE_URL"] if ENV["DATABASE_URL"]?` thats how it looks in application cr
<FromGitter> <kevinelliott> Yeah, that’s what I had
<FromGitter> <kevinelliott> But for some reason it was empty sometimes
<FromGitter> <eliasjpr> mmm
<FromGitter> <eliasjpr> interesting
<FromGitter> <eliasjpr> how is amber treating you?
<FromGitter> <kevinelliott> Good!
<FromGitter> <eliasjpr> enjoying it?
<FromGitter> <eliasjpr> nice! look forward to see the things you build with amber
<FromGitter> <kevinelliott> Definitely. I’m using it for www.cry.st and plan to use it for www.crystal.sh and quite likely for shards db UI that I’m going to be working with @straight-shooter on (though will need to discuss that with him).
<FromGitter> <kevinelliott> After that, my hope is that I’m contributing back to Amber and related crystal shards so that I can start using it in a more professional capacity and help grow the community at the same time.
<FromGitter> <eliasjpr> sweet!
<FromGitter> <eliasjpr> PRs welcome!
<FromGitter> <kevinelliott> Great, will do.
<FromGitter> <Blacksmoke16> i need to get more people using athena, feedback would be nice
<FromGitter> <Blacksmoke16> any progress on your schema thing @eliasjpr ?
<FromGitter> <kevinelliott> @Blacksmoke16 I’ll probably give athena a whirl soon
<FromGitter> <Blacksmoke16> ayy, thanks. appreciate it
<FromGitter> <Blacksmoke16> should be fairly easy to get going
<FromGitter> <kevinelliott> What do you guys think? http://www.cry.st
<FromGitter> <kevinelliott> Good god crystal and amber is fast.
<FromGitter> <Blacksmoke16> fancy
<FromGitter> <Blacksmoke16> ikr? got my api running athena and response time locally is like 4ms, with 2 db queries as well
<FromGitter> <Blacksmoke16> is insane
<FromGitter> <Blacksmoke16> i use same router as amber so id imagine response time would be similar
<FromGitter> <Blacksmoke16> ruby took like 150 or something
<FromGitter> <Blacksmoke16> anyway, glad you got it working, is a good start. imma get to bed, catch you later o/
<FromGitter> <kevinelliott> Thanks @Blacksmoke16 me too. Sounds good man, see ya later!
<FromGitter> <vifreefly> It looks like there is already Sequel-inspired ORM in Crystal (https://github.com/anykeyh/clear). ⏎ Looks nike, I love that virtual blocks style, example: `User.query.find{ email =~ /yacine/i }`
<FromGitter> <vifreefly> I think author did the right thing trying to concentrate only on the one ORM - Postgres (instead of supporting all 3). Do less but better :)
_whitelogger has joined #amber
feepbot has quit [Ping timeout: 268 seconds]
feepbot has joined #amber
<FromGitter> <Blacksmoke16> I used that for a while
<FromGitter> <Blacksmoke16> Yea, worked quite well
<FromGitter> <eliasjpr> I’m still working, I actually had to use the JSON and Yaml annotations
<FromGitter> <Blacksmoke16> vs the mapping?
<FromGitter> <eliasjpr> yes
<FromGitter> <eliasjpr> the nesting and the JSON.mapping do not work well with eachother
<FromGitter> <Blacksmoke16> gotcha
<FromGitter> <Blacksmoke16> way i but CrSerializer is on top of that serializable functionality, so like https://github.com/Blacksmoke16/CrSerializer/blob/master/src/CrSerializer/base.cr#L97 with a custom override of `to_json` to pass in the groups
<FromGitter> <Blacksmoke16> have the annotations on them helps, https://github.com/Blacksmoke16/CrSerializer/blob/master/src/CrSerializer/assertions/valid.cr was also pretty clever, if you could do something similar for your nested validations
<FromGitter> <Blacksmoke16> as if each child obj has a "validator" or something can just iterate over them
<FromGitter> <Blacksmoke16> there's also nothing stopping you from adding additional fields to the `JSON::Field` to read off of, wouldnt work with standard crystal `to_json` tho
<FromGitter> <eliasjpr> I am fining myself to have to override the to_json and to_yaml
<FromGitter> <eliasjpr> thanks for the snippets, definitely helpful
<FromGitter> <Blacksmoke16> id have rather not either, but unless some functionality gets added to stdlib, its just not possible
<FromGitter> <Blacksmoke16> such as the groups
<FromGitter> <eliasjpr> I feel the same way
<FromGitter> <eliasjpr> I do not want to override the `to_json`
<FromGitter> <Blacksmoke16> more of a chance of developing them if they get split out into their own shards imo
<FromGitter> <eliasjpr> Puff, was able to add the nested json without needing to change the Crystal implementation
<FromGitter> <eliasjpr> 😅
<FromGitter> <Blacksmoke16> \o/
<FromGitter> <Blacksmoke16> nice one
deadalnix has joined #amber
deadalnix has quit [Remote host closed the connection]
deadalnix has joined #amber
<FromGitter> <kevinelliott> @Blacksmoke16 @eliasjpr Why don’t the two of you submit a crystal PR to augment it?
<FromGitter> <Blacksmoke16> should already be a thing, can just call to_json on a parent and it just works (assuming you are using serializable) in each
<FromGitter> <Blacksmoke16> but would be a question for core team if stuff like serialization groups should be added in
<FromGitter> <kevinelliott> Yeah that’s what I’m referring to (the earlier talk)
<FromGitter> <kevinelliott> Not overriding
<FromGitter> <Blacksmoke16> having groups and since/when would be super nice, would pretty much be able to just wrap to/from_json at that point
<FromGitter> <Blacksmoke16> ideally imo, id like for my shard to be obsolete if stdlib supports it all at some point
<FromGitter> <Blacksmoke16> but see how it goes
<FromGitter> <kevinelliott> Semi-unrelated: Ruby 2.6’s new `then` exception handling is pretty dope.
<FromGitter> <Blacksmoke16> example?
<FromGitter> <kevinelliott> `Event.upcoming ⏎ .then(&method(:with_limit)) ⏎ .then(&method(:with_status))`
<FromGitter> <Blacksmoke16> hm
<FromGitter> <kevinelliott> It’s mostly just an alias to `yield_self`, but in some cases it acts like a rescue.
<FromGitter> <kevinelliott> Oops, I’m wrong. It’s just an alias to `yield_self`… the exception handling I’m thinking of `else`.
<FromGitter> <kevinelliott> ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5c34e512aac7082e6ff3d767]
<FromGitter> <kevinelliott> Anyway, ignore, unrelated.
<FromGitter> <eliasjpr> it turns out that crystals from_json uses a after_initialize method
<FromGitter> <eliasjpr> that made it easy to extend it without overwritting the implementation
<FromGitter> <Blacksmoke16> what did you extend?
<FromGitter> <eliasjpr> See
<FromGitter> <Blacksmoke16> @eliasjpr nice one
<FromGitter> <Blacksmoke16> i always thought it would be cool to have a parm field on the json annotation, that is like `set this ivar to the value at the end of this path`
<FromGitter> <Blacksmoke16> i.e. to extract a value from a json obj/nested json obj w/o building out a bunch more structs or something
<FromGitter> <eliasjpr> With the hook method I was able to need to store the params payload in each of the schemas
<FromGitter> <eliasjpr> > i always thought it would be cool to have a parm field on the json annotation, that is like `set this ivar to the value at the end of this path` ⏎ ⏎ I thought that was exactly why the annotation was needed
<FromGitter> <Blacksmoke16> it would allow you do to something like `@[JSON::Field(path: ["path", "to","var"])]`
<FromGitter> <Blacksmoke16> but you cant implement it w/o overriding `from_json`, or if that gets added to `from_json`
<FromGitter> <eliasjpr> I see
<FromGitter> <eliasjpr> Yeah that would pretty cool
<FromGitter> <eliasjpr> it does have a key and root argument
<FromGitter> <eliasjpr> I think thats the intention
<FromGitter> <Blacksmoke16> root is good but only goes one level deep, plus key does more than you think
<FromGitter> <Blacksmoke16> key also changes that propertie's key name on to_json
<FromGitter> <Blacksmoke16> which kinda makes sense now, but id rather it be split, like serialize_key and deserialize_key
<FromGitter> <eliasjpr> got it
<FromGitter> <Blacksmoke16> plus another thing root does is like
<FromGitter> <Blacksmoke16> let me make an exampe...
<FromGitter> <eliasjpr> With the schema you should be able to represent the json as it is nested
<FromGitter> <eliasjpr> 🎉
<FromGitter> <eliasjpr> Self documenting
<FromGitter> <eliasjpr> 💥
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/5ybl
<FromGitter> <Blacksmoke16> root assumes the value is *within* another object with the key the same as the property
<FromGitter> <Blacksmoke16> or what the key field is set to
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/5ybo also build the json out in the same structure it was in
<FromGitter> <eliasjpr> I got confused
<FromGitter> <eliasjpr> I thought the root is for the higher level and key is for well the key value pair
<FromGitter> <eliasjpr> but your last example the root is the key and the key is the root
<FromGitter> <eliasjpr> `data` to me is the root
<FromGitter> <eliasjpr> and the key is `value`
<FromGitter> <Blacksmoke16> ikr?
<FromGitter> <Blacksmoke16> kinda strange
<FromGitter> <eliasjpr> check this out https://play.crystal-lang.org/#/r/5ybr
<FromGitter> <Blacksmoke16> yes, it resolves key before root iirc
<FromGitter> <eliasjpr> I just message the crystal main channel
<FromGitter> <Blacksmoke16> PLUS, you cant have more than 1 property with the same `key` property
<FromGitter> <Blacksmoke16> so like
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/5ybu
<FromGitter> <Blacksmoke16> whole thing im not a big fan of imo, hence why i wrote my own :P
<FromGitter> <eliasjpr> yeah definitely there is a bug there or I am not understanding it correctly
<FromGitter> <Blacksmoke16> could be
<FromGitter> <Blacksmoke16> thing that sucks is to fix this would also have to fix the yaml one
<FromGitter> <eliasjpr> yes
<FromGitter> <eliasjpr> maybe yaml work slightly different
<FromGitter> <eliasjpr> I wonder if there is another json parsing library written in crystal
<FromGitter> <eliasjpr> that has its own implementation
<FromGitter> <drujensen> That is definitely backwards
<FromGitter> <eliasjpr> I can understand if someone does built its own JSON parser
<FromGitter> <Blacksmoke16> not sure, maybe look how the mapping worked?