Ilya is a Cloud Native Architect, he is an expert in the world of cloud technologies and distributed systems. He helps SMBs to earn more and spend less with proper cloud decisions.
Not sure if there is the correct use case for your package. The go program I am building needs a config file for API logins and passwords. The config file will have human readable values but I need to save an encrypted value for a password. I use Setter to unencrypt the value. But I am building a config file editor to allow editing the text password and then encrypt it in the config file.
Ilya is a Cloud Native Architect, he is an expert in the world of cloud technologies and distributed systems. He helps SMBs to earn more and spend less with proper cloud decisions.
I think you can just use gopkg.in/yaml.v2 to encrypt any structure to YAML and print it to the file. So you don't need any special logic here, because your app prepares some data (which is out of the scope of how to push it to the file), and then you just need to save it.
You also can use default json or toml encoders if you want. No real need to build something extra.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
what about a function to write out the configuration to a file.
Like SaveConfig(path string, cfg interface{}) error
Honestly, I didn't think anybody would want it. In which cases could it be used?
Not sure if there is the correct use case for your package. The go program I am building needs a config file for API logins and passwords. The config file will have human readable values but I need to save an encrypted value for a password. I use Setter to unencrypt the value. But I am building a config file editor to allow editing the text password and then encrypt it in the config file.
I think you can just use
gopkg.in/yaml.v2
to encrypt any structure to YAML and print it to the file. So you don't need any special logic here, because your app prepares some data (which is out of the scope of how to push it to the file), and then you just need to save it.You also can use default json or toml encoders if you want. No real need to build something extra.