-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:insolar/insolar into NOISSUE-fix-…
…pulsar-distribution # Conflicts: # scripts/generate_insolar_configs.go # scripts/insolard/launchnet.sh
- Loading branch information
Showing
66 changed files
with
992 additions
and
408 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Pulse Watcher | ||
=============== | ||
|
||
Usage | ||
---------- | ||
#### Build | ||
|
||
make pulsewatcher | ||
|
||
#### Start blockchain | ||
|
||
./scripts/insolard/launchnet.sh -g | ||
|
||
#### Start pulsewatcher | ||
|
||
./bin/pulsewatcher -c scripts/insolard/configs/generated_configs/utils/pulsewatcher.yaml | ||
|
||
### Options | ||
|
||
-c config file | ||
Path to configuration file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright 2019 Insolar | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package pulsewatcher | ||
|
||
import ( | ||
"io/ioutil" | ||
"os" | ||
"path/filepath" | ||
"time" | ||
|
||
"gopkg.in/yaml.v2" | ||
) | ||
|
||
type Config struct { | ||
Nodes []string | ||
Interval time.Duration | ||
Timeout time.Duration | ||
} | ||
|
||
func WriteConfig(dir string, file string, conf Config) error { | ||
err := os.MkdirAll(dir, 0775) | ||
if err != nil { | ||
return err | ||
} | ||
data, err := yaml.Marshal(conf) | ||
if err != nil { | ||
return err | ||
} | ||
return ioutil.WriteFile(filepath.Join(dir, file), data, 0644) | ||
} | ||
|
||
func ReadConfig(file string) (*Config, error) { | ||
var conf Config | ||
data, err := ioutil.ReadFile(file) | ||
if err != nil { | ||
return nil, err | ||
} | ||
err = yaml.Unmarshal(data, &conf) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &conf, nil | ||
} |
Oops, something went wrong.