<FromGitter>
<Blacksmoke16> @straight-shoota The config file isn't editable via code so having it be compiled once to allow for the ECR rendering is fine. I'm also using it for extending the `HTTP::Handler`, like: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ so that each handler has access to the context, the action (if one was matched) and the config object that gets read and passed in at run time
<FromGitter>
<Blacksmoke16> but yea i suppose it limits the useability of the config file outside of this, but :shrug:
<FromGitter>
<Blacksmoke16> would be diff it was writable, prob not a big deal
<FromGitter>
<johnjansen> its very normal to interpolate env variables into config files, and infact ideal in many cases. here is a common use case in ruby on rails (in this case Gitlab CI) - rails uses yaml extensively for config so there are tons of good examples of this kind of config modification in the ruby world ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c9580ca8126720abc29b59a]
<FromGitter>
<Blacksmoke16> maybe, in its early stages atm
<FromGitter>
<johnjansen> maybe
<FromGitter>
<Blacksmoke16> @girng `the more I need to focus and have that confidence of writing good code. Why? Because this will allow me to write more instead of writing 1 line, then “compile and test”.` would help if you wrote tests :trollface:
<FromGitter>
<girng> Yeah, that too. I used to stop after 1 line and compile and test, just for the sole reason to make sure the code is legit and I get no compiler errors. Now, not so much. Because a) I know subconsciously about the compile time. and b) That line will work because I've used it before, and understand the language better
<FromGitter>
<girng> Compile times have made me into a better programmer with Crystal
_whitelogger has joined #crystal-lang
return0e has quit [Read error: Connection reset by peer]
return0e_ has joined #crystal-lang
<FromGitter>
<Blacksmoke16> dont think there is a way to generate those default tags tho?
<FromGitter>
<Blacksmoke16> could just use custom to_yaml, wouldnt be that bad for my use case
return0e has quit [Read error: Connection reset by peer]
return0e_ has joined #crystal-lang
<FromGitter>
<straight-shoota> @johnjansen @Blacksmoke16 Crinja would really work for this, but it's also a bit heavy for a simple task like inserting a few environment variables, which could probably be implemented similar to `yaml_source.gsub('<%= ENV_VAR %>', ENV['ENV_VAR'])`
ashirase has quit [Ping timeout: 252 seconds]
laaron- has quit [Remote host closed the connection]
laaron has joined #crystal-lang
ashirase has joined #crystal-lang
_whitelogger has joined #crystal-lang
DTZUZO has quit [Ping timeout: 246 seconds]
<Groogy>
Morning! O/
_whitelogger has joined #crystal-lang
Yxhuvud has joined #crystal-lang
<FromGitter>
<TheOnlyArtz> Hey!
<FromGitter>
<TheOnlyArtz> How can I access an object in an Array by itself?
<Yxhuvud>
What do you expect as output of array[client] ?
<FromGitter>
<TheOnlyArtz> To get the client
<Yxhuvud>
But you obviously already have the client?
<FromGitter>
<TheOnlyArtz> No, I have an array of clients (custom objects) who all have the properties of `tcp` which includes their own `tcp connection`
<FromGitter>
<TheOnlyArtz> I need to find the client who has the specific `tcp` connection
<Yxhuvud>
something like array.find {|client| client.connection == something } ?
<FromGitter>
<TheOnlyArtz> Basically I'm working with packets here and every tcp connection gets it's own object ⏎ Whenever a player moves (It's a gameserver) I will need to fetch that specific tcp connection from the clients array ⏎ and update his position
<FromGitter>
<TheOnlyArtz> But that will cause an error at compilation time, trying to access certain properties of `CustomObject | Nil`
<Groogy>
then that means you have the union type of CustomObject | Nil in the array so you have to first check that the object you testing against is not nil
<FromGitter>
<TheOnlyArtz> Eventually Entities will have IDs too, right now we are using the ID's for the Player where there we generate a random UInt32 number
<FromGitter>
<bew> That method could be written (if you change initialize to `def initialize(@tcp : TCPSocket, @id); ...`: ⏎ ⏎ ```player_id = Random.new.rand(1e7).to_u32 ⏎ new(socket, player_id)``` [https://gitter.im/crystal-lang/crystal?at=5c96365af3dbbd230ca40198]
lucasb has joined #crystal-lang
<FromGitter>
<TheOnlyArtz> I guess it's possible
<FromGitter>
<TheOnlyArtz> I will look into it layer
<FromGitter>
<j8r> We have to parse it to modify it anyway
<FromGitter>
<dscottboggs_gitlab> oh cool that's great :D
<FromGitter>
<j8r> I was a bit afraid to use it at first, system users are sensitive. I had no problem with it so far on my systems
<FromGitter>
<dscottboggs_gitlab> There's no `User#groups` :/ but I can work with it
<FromGitter>
<j8r> what do you want? Alls groups?
<FromGitter>
<j8r> of an user?
<FromGitter>
<j8r> yes, this doesn't work like that. Groups have users, not the other way around
<FromGitter>
<j8r> I can create an helper method for this
<FromGitter>
<j8r> I have to make a new release anyway, to close the Files IO
<FromGitter>
<dscottboggs_gitlab> it's ok I already got it set up like I wanted, but I'm confused, why does `User#password` return a `PasswordState` instead of a `Password`?
<FromGitter>
<dscottboggs_gitlab> WAIT do we have algebraic enums like Rust??
<FromGitter>
<dscottboggs_gitlab> *Sweet*
<FromGitter>
<dscottboggs_gitlab> yeah no I'm confused
<FromGitter>
<dscottboggs_gitlab> never mind I see... there is `Libcrown#passwords` or `#get_password` for that. A very functional way to do it but ok
<FromGitter>
<j8r> I've wanted to stay as close as possible to the actual API provided by the files
crystal-lang564 has quit [Quit: Konversation terminated!]
f1refly has joined #crystal-lang
<f1refly>
Is there a way to sort a hash by its values?