Install the following dependencies
If you want to browse api with SSL self-signed certificate
brew install go-task/tap/go-task
brew install golangci-lint
go install github.com/oligot/go-mod-upgrade@latest
go install entgo.io/ent/cmd/ent@latest
brew install mkcert
brew install nginx
task test
task build
Environment configuration is based on Archaius Config, you should use a similar folder structure. SCOPE env variable in remote environment is required
└── config
├── config.yml (shared config)
└── dev
└── config.yml (for local development)
└── prod (for remote environment)
└── config.yml (base config)
└── {environment}.config.yml (base config)
The SDK provides a simple configuration hierarchy
- resources/config/config.properties (shared config)
- resources/config/{environment}/config.properties (override shared config by environment)
- resources/config/{environment}/{scope}.config.properties (override env and shared config by scope)
example test.pets-api.internal.com
└── config
├── config.yml third
└── dev
└── config.yml ignored
└── prod
└── config.yml (base config) second
└── test.config.yml (base config) first
2022/11/20 13:24:26 INFO: Two files have same priority. keeping
/resources/config/prod/test.config.yml value
2022/11/20 13:24:26 INFO: Configuration files:
/resources/config/prod/test.config.yml,
/resources/config/prod/config.yml,
/resources/config/config.yml
2022/11/20 13:24:26 INFO: invoke dynamic handler:FileSource
2022/11/20 13:24:26 INFO: enable env source
2022/11/20 13:24:26 INFO: invoke dynamic handler:EnvironmentSource
2022/11/20 13:24:26 INFO: archaius init success
2022/11/20 13:24:26 INFO: ENV: prod, SCOPE: test
2022/11/20 13:24:26 INFO: create new watcher
2022/11/20 13:24:26 Listening on port 8080
2022/11/20 13:24:26 Open http://127.0.0.1:8080/ping in the browser
RestPool and RestClient are dynamically created by config files.
# gitlab
rest:
pool:
default:
pool:
size: 20
timeout: 2000
connection-timeout: 5000
client:
gitlab:
pool: default
var restClients = config.ProvideRestClients()
gitLabClient := gitlab.NewGitLabClient(restClients.Get("gitlab"))
SECRETS_STORE_GITLAB_TOKEN_KEY_NAME={gitlab_access_token} SECRETS_STORE_PROD_CONNECTION_STRING_KEY_NAME={mysql_connection_string}