Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

# Generate dashboard JSON and print to stdout
dashboard:
@bundle exec grafantastic
@bundle exec diffdash

# Generate dashboard with verbose output
dashboard-verbose:
@bundle exec grafantastic --verbose
@bundle exec diffdash --verbose

# Dry run - generate JSON only, never upload
dashboard-dry:
@bundle exec grafantastic --dry-run
@bundle exec diffdash --dry-run

# Install dependencies
install:
Expand All @@ -30,8 +30,8 @@ clean:

# Build the gem
build:
@gem build grafantastic.gemspec
@gem build diffdash.gemspec

# Install the gem locally
install-gem: build
@gem install grafantastic-*.gem
@gem install diffdash-*.gem
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Set these in a `.env` file in your project root:
| `GRAFANA_URL` | Yes | Grafana instance URL (e.g., `https://myorg.grafana.net`) |
| `GRAFANA_TOKEN` | Yes | Grafana API token (Service Account token with Editor role) |
| `GRAFANA_FOLDER_ID` | No | Target folder ID for dashboards |
| `GRAFANTASTIC_DRY_RUN` | No | Set to `true` to force dry-run mode |
| `DIFFDASH_DRY_RUN` | No | Set to `true` to force dry-run mode |

## Output

Expand Down
4 changes: 2 additions & 2 deletions lib/diffdash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def self.run(args)
def initialize(args)
@args = args
@config = Config.new
@dry_run = ENV["GRAFANTASTIC_DRY_RUN"] == "true" || args.include?("--dry-run")
@dry_run = ENV["DIFFDASH_DRY_RUN"] == "true" || args.include?("--dry-run")
@help = args.include?("--help") || args.include?("-h")
@verbose = args.include?("--verbose") || args.include?("-v")
@subcommand = extract_subcommand(args)
Expand Down Expand Up @@ -278,7 +278,7 @@ def print_help
GRAFANA_URL Grafana instance URL (required)
GRAFANA_TOKEN Grafana API token (required)
GRAFANA_FOLDER_ID Target folder ID (optional)
GRAFANTASTIC_DRY_RUN Set to 'true' to force dry-run mode
DIFFDASH_DRY_RUN Set to 'true' to force dry-run mode

Output:
Prints valid Grafana dashboard JSON to STDOUT.
Expand Down
2 changes: 1 addition & 1 deletion lib/diffdash/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def grafana_folder_id
end

def dry_run?
ENV["GRAFANTASTIC_DRY_RUN"] == "true"
ENV["DIFFDASH_DRY_RUN"] == "true"
end
end
end
12 changes: 6 additions & 6 deletions spec/diffdash/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@
end

describe "#dry_run?" do
it "returns true when GRAFANTASTIC_DRY_RUN is 'true'" do
allow(ENV).to receive(:[]).with("GRAFANTASTIC_DRY_RUN").and_return("true")
it "returns true when DIFFDASH_DRY_RUN is 'true'" do
allow(ENV).to receive(:[]).with("DIFFDASH_DRY_RUN").and_return("true")
expect(config.dry_run?).to be true
end

it "returns false when GRAFANTASTIC_DRY_RUN is not 'true'" do
allow(ENV).to receive(:[]).with("GRAFANTASTIC_DRY_RUN").and_return("false")
it "returns false when DIFFDASH_DRY_RUN is not 'true'" do
allow(ENV).to receive(:[]).with("DIFFDASH_DRY_RUN").and_return("false")
expect(config.dry_run?).to be false
end

it "returns false when GRAFANTASTIC_DRY_RUN is not set" do
allow(ENV).to receive(:[]).with("GRAFANTASTIC_DRY_RUN").and_return(nil)
it "returns false when DIFFDASH_DRY_RUN is not set" do
allow(ENV).to receive(:[]).with("DIFFDASH_DRY_RUN").and_return(nil)
expect(config.dry_run?).to be false
end
end
Expand Down
Loading