Skip to content

Raise Unhandled exception: Expected Array or Hash, not String (Exception) if no .env exists #1988

@zw963

Description

@zw963

Describe the bug
When run lucky project on production use a static build binary, if there is no .env file exists, when run Lucky::ServerSettings.host to get the value, will raise following exception: (It really not help for this cause)

crystal_china@stuent111:~/apps/website_production$ ls
bin
crystal_china@stuent111:~/apps/website_production$ bin/crystal_china
Unhandled exception: Expected Array or Hash, not String (Exception)
  from /home/zw963/Crystal/share/crystal/src/yaml/any.cr:108:7 in '[]'
  from /home/zw963/Crystal/crystal-china/website/lib/lucky/src/lucky/server_settings.cr:11:25 in 'host'
  from /home/zw963/Crystal/crystal-china/website/config/server.cr:20:5 in '__crystal_main'
  from /home/zw963/Crystal/share/crystal/src/crystal/main.cr:129:5 in 'main_user_code'
  from /home/zw963/Crystal/share/crystal/src/crystal/main.cr:115:7 in 'main'
  from /home/zw963/Crystal/share/crystal/src/crystal/system/unix/main.cr:9:3 in 'main'

Versions (please complete the following information):

  • Lucky version (check in shard.lock): 1.3.0
  • Crystal version (crystal --version): 1.16.3
  • OS: Arch

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions