Skip to content

Instantly share code, notes, and snippets.

@gabsn
Last active September 25, 2017 19:21
Show Gist options
  • Save gabsn/235d813e72ff5e64aa926afe2c70a8bb to your computer and use it in GitHub Desktop.
Save gabsn/235d813e72ff5e64aa926afe2c70a8bb to your computer and use it in GitHub Desktop.
Datadog Internship

Internship Report

App Configuration

  • We can use different ways to configure an app: local/global variables, flags, environment variables, config files.
  • Solutions like viper exist for go apps to combine those solutions all together.
  • Should we use environment variables for app configuration?
    In my opinion, all the OS-dependent configuration options should be passed explicitly at the start of the application. Flags are the perfect way for that, because on the contrary of env variables, it's os-independent and explicit.

Here are all the reasons why we shouldn't use environment variables:

  • Dynamically set: they can be set by other users, so we are not really sure of their value across the time.
  • OS-dependent: risks of collision, for example if a variable X has a special meaning in one OS.
  • Implicit dependencies: env variables are a form of dependency for our app, and experience has shown that dependencies should always be explicit.

-> Best practices:

JSON, YAML and TOML

  • strictYAML proposes a simplified implementation of YAML spec.

Principle of least astonishment

  • "If a necessary feature has a high astonishment factor, it may be necessary to redesign the feature." (wiki)

Semantic Versioning

  • semver is a good practice to follow when releasing public faced software.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment