diff --git a/components/notifications-service2/cmd/notifications-service/commands/root.go b/components/notifications-service2/cmd/notifications-service/commands/root.go index 4d03e0cd559..0b8a80e7171 100644 --- a/components/notifications-service2/cmd/notifications-service/commands/root.go +++ b/components/notifications-service2/cmd/notifications-service/commands/root.go @@ -16,8 +16,6 @@ func RootCmd() *cobra.Command { return r } -// Execute adds all child commands to the root command sets flags appropriately. -// This is called by main.main(). It only needs to happen once to the rootCmd. func Execute() { if err := RootCmd().Execute(); err != nil { log.Error(err) diff --git a/components/notifications-service2/habitat/config/config.toml b/components/notifications-service2/habitat/config/config.toml index 6189f412047..17784f8fe84 100644 --- a/components/notifications-service2/habitat/config/config.toml +++ b/components/notifications-service2/habitat/config/config.toml @@ -4,10 +4,6 @@ port = {{cfg.service.port}} external_fqdn = "{{cfg.service.external_fqdn}}" log_level = "{{cfg.log.level}}" -## TODO: is this needed? -# export CACHE_TIMEOUT_MS_EVENT_RULE="{{cfg.cache.event_rule_timeout_ms}}" -# export EVENT_DEDUP_WINDOW_SECONDS="{{cfg.service.dedup_window_seconds}}" - [postgres] database = "{{cfg.storage.database}}" schema_path = "{{pkg.path}}/schema" diff --git a/components/notifications-service2/habitat/default.toml b/components/notifications-service2/habitat/default.toml index ba154d609b7..7051bc7e6b8 100644 --- a/components/notifications-service2/habitat/default.toml +++ b/components/notifications-service2/habitat/default.toml @@ -4,17 +4,10 @@ accept = false [service] external_fqdn="http://localhost" host = "localhost" -port = 4001 - -# How long in seconds must pass before we consider -# an inbound event with the same id and type as not a duplicate -dedup_window_seconds = 300 +port = 10125 [storage] database = "notifications_service" max_open_conns = 10 max_idle_conns = 10 - -[cache] -event_rule_timeout_ms = 5000 diff --git a/components/notifications-service2/habitat/plan.sh b/components/notifications-service2/habitat/plan.sh index 98c19fc4c8e..f49e4ad1e27 100644 --- a/components/notifications-service2/habitat/plan.sh +++ b/components/notifications-service2/habitat/plan.sh @@ -29,21 +29,6 @@ pkg_binds=( pkg_bin_dirs=(bin) pkg_lib_dirs=(lib) -# The service files and directories -# NOTE: this has nothing to do with habitat. It is used for -# determining when a build is stale in the studiorc -pkg_srcs=( - server/lib - server/priv - server/rel - server/config.exs - server/Makefile - server/mix.exs - server/mix.lock - - # TODO: VERSION should be in this list -) - pkg_scaffolding="${local_scaffolding_origin:-chef}/automate-scaffolding-go" scaffolding_go_base_path=github.com/chef scaffolding_go_repo_name=automate @@ -55,10 +40,10 @@ scaffolding_go_binary_list=( "${scaffolding_go_import_path}/cmd/${pkg_name}" ) -## . scaffolding_go_import_path="${scaffolding_go_base_path}/${scaffolding_go_repo_name}/components/${pkg_name}" -## . scaffolding_go_binary_list=( -## . "${scaffolding_go_import_path}/cmd/${pkg_name}" -## . ) +## scaffolding_go_import_path="${scaffolding_go_base_path}/${scaffolding_go_repo_name}/components/${pkg_name}" +## scaffolding_go_binary_list=( +## "${scaffolding_go_import_path}/cmd/${pkg_name}" +## ) do_install() { do_default_install @@ -72,4 +57,3 @@ do_strip() { return 0 } - diff --git a/components/notifications-service2/pkg/config/service.go b/components/notifications-service2/pkg/config/service.go index 549067f6e19..4c0f26c5517 100644 --- a/components/notifications-service2/pkg/config/service.go +++ b/components/notifications-service2/pkg/config/service.go @@ -43,7 +43,7 @@ type Secrets struct { // certs), sets derived config and populates global state (e.g., log level, // etc.) func FromFile(path string) (*Notifications, error) { - n, err := marshalFromFile(path) + n, err := MarshalFromFile(path) if err != nil { return nil, err } @@ -53,14 +53,14 @@ func FromFile(path string) (*Notifications, error) { if err := n.SetLogLevel(); err != nil { return nil, err } - if err := n.readCerts(); err != nil { + if err := n.ReadCerts(); err != nil { return nil, err } return n, nil } -func marshalFromFile(path string) (*Notifications, error) { +func MarshalFromFile(path string) (*Notifications, error) { viper.SetConfigFile(path) err := viper.ReadInConfig() @@ -94,7 +94,7 @@ func (n *Notifications) SetLogLevel() error { return n.Service.SetLogLevel() } -func (n *Notifications) readCerts() error { +func (n *Notifications) ReadCerts() error { certs, err := n.TLSConfig.ReadCerts() if err != nil { return err diff --git a/components/notifications-service2/pkg/config/service_test.go b/components/notifications-service2/pkg/config/service_test.go index 9d74e06dd2b..fe29cb4675c 100644 --- a/components/notifications-service2/pkg/config/service_test.go +++ b/components/notifications-service2/pkg/config/service_test.go @@ -49,7 +49,7 @@ func TestConfigMarshaling(t *testing.T) { err = f.Close() require.NoError(t, err) - unmarshaled, err := marshalFromFile(f.Name()) + unmarshaled, err := MarshalFromFile(f.Name()) require.NoError(t, err) assert.Equal(t, original, unmarshaled) } @@ -96,7 +96,7 @@ func TestConfigReadCerts(t *testing.T) { RootCACertPath: "/src/dev/certs/Chef_Automate_FAKE_Dev.crt", }, } - err := nValid.readCerts() + err := nValid.ReadCerts() require.NoError(t, err) }