Config file not found on server where go is not installed

Hi…
I worked on project which has .yaml files in its config package when i run after building it on my system it works fine but when i try to run this a server where go is not installed it throws error of file not found. I know there is no $GOPATH on server but installing go is not the solution i want to know how we can address this problem and what are possible ways to resolve this.
Summary of what i am doing and where i need help

  1. i am trying to run my build file on serve where go is not installed
  2. Config file have messages names, server addresses and other things
  3. these files located under /config directory of my project
  4. i am using sp13/viper for loading them

My code is loading the configuration and running on my system but when i run the binaries of project on server where go is not installed it throws error of file not found (on my system i didn’t have this error)

What are you trying to do? Do you want to load the YAML files? Where are these files located? How do you load them.

Please show us the relevant parts of your code.

1 Like
  1. i am trying to run my build file on serve where go is not installed
  2. Config file have messages names, server addresses and other things
  3. these files located under /config directory of my project
  4. i am using sp13/viper for loading them

My code is loading the configuration and running on my system but when i run the binaries of project on server where go is not installed it throws error of file not found (on my system i didn’t have this error)

The most simplest solution is probably to create the files on the server as well, assuming from your description you currently read them using a relative path, so recreate that path relative to where you start the deployed artifact and it should work.

1 Like

is there any other way to do this because i don’t think i will help me

Either hardoce the configuration or read it from files, those files need to be available on the server of course.

My prefered way is to have a default config hardcoded, then a file loaded from a default location which overwrites the defaults. Or load the config file from a location specified via a command line flag.

I typically give my application a --config option which specifies where it looks for the config file. That way I can put the config wherever the server needs it to be, and then tell the application where to find it.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.